You need to override the default JSON formatting that is installed in this file . The format you want to use will be as follows:
strftime('%Y/%m/%d %H:%M:%S.%6N %z')
And you can fix JSON DateTime output like this
class DateTime
def as_json(options = nil)
strftime('%Y/%m/%d %H:%M:%S.%6N %z')
end
end
And here is the link to the fractional time references available in strftime ()% N - Fractional seconds, defaults to 9 digits (nanosecond)
%3N millisecond (3 digits)
%6N microsecond (6 digits)
%9N nanosecond (9 digits)
source
share