Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Extra comma in json results when null column is the first one processed #25
I'm running into an issue when I output json and some of the fields in the select statement are null.
If any of those fields happen to be the first one, we get an extra comma in the output, and that means the result is not valid json.
To see an example of this, make the following modifications to the sakila database:
Update LangFilm.xml to be this:
Then, if you visit that resource:
you should see something like this:
That doesn't validate at jsonlint.org.
If you don't see this, column display order may be platform dependent, but if you remove the name field, you should definitely see the prepended commas.
The issue appears to be in
Proposed solution--use a json generation library: http://stackoverflow.com/questions/1668862/good-json-java-library rather than a hand crafted solution. Alternative solution: revamp the