Unable to Parse Date String in Json String using Document.parse()

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: JSON
    • None
    • Environment:
      Windows 10
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Code:

      static String dateStr = "{ \"name\" : \"Bruce Lee\", \"age\" : 100, \"LossDate\":{\"$date\":'1970-01-01'}}";

      Document doc = Document.parse(dateStr);

       

       

      org.bson.json.JsonParseException: Failed to parse string as a date
      at org.bson.json.JsonReader.visitDateTimeExtendedJson(JsonReader.java:1057)
      at org.bson.json.JsonReader.visitExtendedJSON(JsonReader.java:618)
      at org.bson.json.JsonReader.readBsonType(JsonReader.java:148)
      at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:149)
      at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:45)

            Assignee:
            Unassigned
            Reporter:
            shen Chen
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: