Grails json string converter with dates

I pass json data to the Grails controller, which I then process with JSON.parse. Everything works fine except for the date fields. I don't believe json has an explicit syntax for representing dates, but I tried several formats with no luck. Can someone tell me which format I should use so that the grails JSON parser can create a Date object.

+3
source share
1 answer

There is no specific format, but you can define your own. For example, these guys here add “@” to the beginning and end of the line.

According to the Grails docs here , you can define:

grails.converters.json.date (String). , Date JSON

  • "default" - JSON
  • "javascript" - (...)

. -, Java Date mapping. , , parse

+1

Source: https://habr.com/ru/post/1756566/


All Articles