The Class JsonFormatWriter creates an invalid JSON representation in case that
an OEntity object doesn't contain any OProperty instances but
ORelatedEntityLink instances.
This might occurs on requests which uses projection ($select operator) only on
navigation properties like
http://localhost:8080/myodataservice/odata.svc/Products?$select=Supplier&$format
=json
The JsonFormatWriter will then create following invalid JSON representation of
the OEntity object:
{
"d" : {
"results" : [
{
"__metadata" : {
"uri" :
"http://localhost:8080/myodataservice/odata.svc/Products('c40423f4-6400-4bd1-b46
0-7f3606429c2e')", "type" : "ODataDemo.Product"
}, , "Supplier" : {
"__deferred" : {
"uri" :
"http://localhost:8080/myodataservice/odata.svc/Products('c40423f4-6400-4bd1-b46
0-7f3606429c2e')/Supplier"
}}}]}}
The JSON representation is invalid because of the two back-to-back comma
between the "__metadata" and the "Supplier" part. \
This might causes an MalformedJsonException in case you try to parse such an
JSON string.
The problem seems to be that the method writeResponseLink() in the class
JsonFormatWriter always first writes a separator (line 262) and therefore
expects that the OEntity object also contains instances of type OProperty.
What steps will reproduce the problem?
1. Make a request with a projection ($select operator) on only a navigation
property and use JSON as a return format
What version of the product are you using? On what operating system?
Version 0.8.0-SNAPSHOT
Original issue reported on code.google.com by andyfich...@gmail.com on 21 Jan 2013 at 7:19
Original issue reported on code.google.com by
andyfich...@gmail.com
on 21 Jan 2013 at 7:19