[JAVA-2589] Keys within extended JSON should not require quotation marks Created: 25/Aug/17  Updated: 29/Oct/23  Resolved: 21/May/22

Status: Closed
Project: Java Driver
Component/s: JSON
Affects Version/s: 3.5.0
Fix Version/s: 4.7.0

Type: Improvement Priority: Minor - P4
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed

 Description   

A JSON document like

{
   operationTime : {$timestamp : {t : 40, i : 20}
}

should parse even though the "t" and "i" fields are unquoted. In 3.5 it throws an exception:

org.bson.json.JsonParseException: JSON reader expected a string but found 't'.
 
	at org.bson.json.JsonReader.readStringFromExtendedJson(JsonReader.java:1126)
	at org.bson.json.JsonReader.visitTimestampExtendedJson(JsonReader.java:1146)
	at org.bson.json.JsonReader.visitExtendedJSON(JsonReader.java:626)
	at org.bson.json.JsonReader.readBsonType(JsonReader.java:148



 Comments   
Comment by Githook User [ 21/May/22 ]

Author:

{'name': 'Saül Yéponde', 'email': 'saul.yeponde@gmail.com', 'username': 'salsama59'}

Message: Quoting the keys within extended JSON is optional

JAVA-2589
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/fa2b65c83dcebe31fd210c0a8e079e6fbf920eb0

Comment by Saül YEPONDE [ 02/Apr/18 ]

Hi Jeff, the pull request is updated now based on your feedbacks.

Comment by Saül YEPONDE [ 18/Mar/18 ]

Hello, I'm new on this project.
I manage to fix the issue, this is my pull request link :

https://github.com/mongodb/mongo-java-driver/pull/463

@jeff yemin : Could you tell me what your thoughts on it?

Thank you.

Generated at Thu Feb 08 08:57:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.