shabiel / M-Web-Server

A YottaDB and Caché compatible HTTP server
Apache License 2.0
24 stars 19 forks source link

Fix JSON encoder bug that produces invalid JSON #43

Closed dlwicksell closed 4 years ago

dlwicksell commented 4 years ago

A previous fix to the JSON encoder, produced invalid JSON. The unit test for that fix looked like this:

D ASSERT(t2(1),"{[{""n"":123,""s"":1},{""N1"":true,""N2"":""true""}]}")

It is invalid because a JSON object cannot contain data, such as an array, without the data value being stored under a key. This pull request improves the previous fix, discussed at:

https://groups.google.com/d/msg/comp.lang.mumps/RcogxQKtkJw/lN7AzAVzBAAJ

It does not, however, attempt to fix any other potential bugs in the JSON processor code.