[CXX-225] mongo::fromjson does not support outermost arrays Created: 11/May/14 Updated: 08/Jul/14 Resolved: 08/Jul/14 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | BSON |
| Affects Version/s: | legacy-0.0-26compat-2.6.0, legacy-0.8.0 |
| Fix Version/s: | legacy-0.11.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Itay Neeman | Assignee: | Tyler Brock |
| Resolution: | Done | Votes: | 0 |
| Labels: | legacy-cxx | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
If you have a JSON string with an outermost array (e.g. "[1,2,3]"), you cannot pass it to mongo::fromjson, as it expects an outermost object. This is a bit unfortunate, given that the underlying JParse can certainly handle it, and there can be an optional boolean to say whether it is an array or not. Again, happy to submit a PR if that will help move this along. |
| Comments |
| Comment by Tyler Brock [ 26/Jun/14 ] | |
|
Resolving for now, let me know if you have any issues and we can re-open. | |
| Comment by Tyler Brock [ 25/Jun/14 ] | |
|
This should be fixed in the legacy branch now, can you try giving fromjson with a top level array another shot? | |
| Comment by Tyler Brock [ 18/Jun/14 ] | |
|
Having taken a closer look at the JSON RFC, top level arrays are in fact valid JSON objects. | |
| Comment by Tyler Brock [ 13/Jun/14 ] | |
|
Hi Itay, The JSON specification does not consider that to be valid JSON (see http://json.org/) A workaround would be to place the array inside a document
|