Description:
json_valid is returning 0 for a valid JSON string. I am working with reddit comment data and this is the JSON block that is should report as valid.
{"gilded":0,"author_flair_css_class":null,"id":"n5","link_id":"t3_7k62w","subreddit":"WTF","downs":0,"ups":1,"edited":false,"score":1,"author":"[deleted]","subreddit_id":"t5_2qh61","body":"Maybe it's because involuntary imprisonment isn't natural. And [punishment](http://en.wikipedia.org/wiki/Punishment_(psychology\\)#Types_of_punishment) is the least effective behavior modifier.\n\nJust sayin'","retrieved_on":1428217161,"author_flair_text":null,"parent_id":"t1_c06vqpp","score_hidden":false,"controversiality":0,"name":"t1_n5","distinguished":null,"archived":true,"created_utc":"1229583186"}
You can use http://json.parser.online.fr/ and copy and paste that string to confirm that it is indeed valid.
How to repeat:
(I've escaped single quotes within this JSON in the following example)
SELECT json_valid('{"gilded":0,"author_flair_css_class":null,"id":"n5","link_id":"t3_7k62w","subreddit":"WTF","downs":0,"ups":1,"edited":false,"score":1,"author":"[deleted]","subreddit_id":"t5_2qh61","body":"Maybe it\'s because involuntary imprisonment isn\'t natural. And [punishment](http://en.wikipedia.org/wiki/Punishment_(psychology\\)#Types_of_punishment) is the least effective behavior modifier.\n\nJust sayin\'","retrieved_on":1428217161,"author_flair_text":null,"parent_id":"t1_c06vqpp","score_hidden":false,"controversiality":0,"name":"t1_n5","distinguished":null,"archived":true,"created_utc":"1229583186"}');
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| json_valid('{"gilded":0,"author_flair_css_class":null,"id":"n5","link_id":"t3_7k62w","subreddit":"WTF","downs":0,"ups":1,"edited":false,"score":1,"author":"[deleted]","subreddit_id":"t5_2qh61","body":"Maybe it\'s because involuntary imprisonment isn\'t nat |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 0 |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Suggested fix:
I haven't narrowed down what part of this JSON is giving the JSON UDF an issue, but hopefully the developer can narrow it down.