[JAVA-733] JSON.parse() should handle $binary object correctly Created: 15/Jan/13  Updated: 19/Mar/13  Resolved: 29/Jan/13

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: 2.10.1
Fix Version/s: 2.11.0

Type: Improvement Priority: Major - P3
Reporter: Sjoerd Mulder Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible

 Description   

When trying to parse a JSON string containing Mongo Extended JSON like: http://www.mongodb.org/display/DOCS/Mongo+Extended+JSON

The JSON.parse utility function doesn't know about this type. Underlying problem is in the JSONCallback.java file which has a if else for a lot of extensions but not the $binary.

example:
JSON.parse(("

{ \"$binary\" : \"YWJjZA==\", \"$type\" : 0 }

"))



 Comments   
Comment by auto [ 23/Jan/13 ]

Author:

{u'date': u'2013-01-23T13:08:16Z', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: Merge pull request #97 from sjoerdmulder/binary_fix

JAVA-733 JSON.parse doesn't handle $binary object correctly
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/d742754affcc229e69eb7adc91d90686e8c2a9a2

Comment by auto [ 23/Jan/13 ]

Author:

{u'date': u'2013-01-15T09:57:37Z', u'email': u'sjoerd@frontendless.nl', u'name': u'Sjoerd Mulder'}

Message: JAVA-733 JSON.parse doesn't handle $binary object correctly
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/645326228a5cb97f62b8f8cd16146a3a1970261b

Comment by Sjoerd Mulder [ 15/Jan/13 ]

Okay, reverted the checkin from the pull request and added #98 and JAVA-734. As far as i can see no big impact on backward compat

Comment by Jeffrey Yemin [ 15/Jan/13 ]

Let's do a new issue/pull for $timestamp. Might wait for 3.0 to fix that one.

Comment by Sjoerd Mulder [ 15/Jan/13 ]

Also found that the $timestamp was still parsed using the "legacy" format. Also added the new format as specified (incorrectly? should be $i and $t objects) on the Mongo Extended JSON page.

Comment by Sjoerd Mulder [ 15/Jan/13 ]

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

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