zzzprojects / sqlfiddle

http://sqlfiddle.com
MIT License
275 stars 52 forks source link

PostgreSQL JSON result handled improperly? #77

Closed bladeoflight16 closed 9 years ago

bladeoflight16 commented 10 years ago

See this fiddle: http://sqlfiddle.com/#!15/5860d/11 It gives this result:

{ "Value": "[{\"a\":1,\"b\":\"value1\"},{\"a\":2,\"b\":\"value2\"},{\"a\":3,\"b\":\"value3\"}]", "Type": "json" }

When I run the same set of commands directly against PostgreSQL, I get the following result:

[{"a":1,"b":"value1"},{"a":2,"b":"value2"},{"a":3,"b":"value3"}]

It seems that SQLFiddle is adding some kind of wrapping around the JSON string in the result. It escapes the string from the result, maps the escaped result to a "Value" key in a JSON object, and adds a "Type": "json" key/value.

Affects PostgreSQL 9.2 and up (since the JSON features were introduced).

bladeoflight16 commented 9 years ago

This appears to be fixed now. I dunno how or when.

jakefeasel commented 9 years ago

Was fixed in the new codebase jakefeasel/sqlfiddle2#18