Questions tagged [jsonlint]

JSONLint is a JSON linting (validation) and formatting tool.

JSONLint, which validates and formats files, is available as a browser based tool as well as a pure JavaScript version.

The latter can be integrated with or another server-side solution for command line usage.

It can also be integrated with any which supports JavaScript for development.

54 questions
47
votes
7 answers

How to determine whether a string is valid JSON?

Does anyone know of a robust (and bullet proof) is_JSON function snippet for PHP? I (obviously) have a situation where I need to know if a string is JSON or not. Hmm, perhaps run it through a JSONLint request/response, but that seems a bit overkill.
Spot
  • 7,962
  • 9
  • 46
  • 55
8
votes
3 answers

xargs command length limits

I am using jsonlint to lint a bunch of files in a directory (recursively). I wrote the following command: find ./config/pages -name '*.json' -print0 | xargs -0I % sh -c 'echo Linting: %; jsonlint -V ./config/schema.json -q %;' It works for most…
Alec Fenichel
  • 1,257
  • 1
  • 13
  • 27
5
votes
2 answers

How can I validate & beautify JSON through a jquery/javascript plugin

I have a requirement where in I get JSON data from backend and I have to show that in textarea.currently, the data comes but its not formatted and validated.Now 1)How can I beautify JSON in the textarea ? 2)How can I validate it before saving ? I…
Ravikiran Bhat
  • 91
  • 1
  • 11
3
votes
2 answers

$.getJSON() works in IE9, but not in Chrome and FireFox, whats wrong in my code?

I developed a web application using IE9 and a text editor. It reads a JSON file, then fills some DIV elements according to that file and the logic of the JavaScript and jQuery code. Under IE9, it works perfectly. Under Chrome, it fails to execute…
Michael Broschat
  • 875
  • 3
  • 10
  • 17
3
votes
3 answers

JSONValue to Indented String

In Delphi XE2, I need to make a function that receives a JSONValue and returns an indented String, much like JSONLint. This JSONValue could be any type of JSON, could be an array, an object, even just a string, so I have to make sure to cover all…
bpromas
  • 684
  • 1
  • 11
  • 25
2
votes
1 answer

Why is this JSON "invalid?"

This JSON passes jsonlint validation. Yet Firefox and Chrome reject it: { "messages": [ { "subject": "One" }, { "subject": "Two" }, { "subject": "Three" } …
Mike Thomsen
  • 36,828
  • 10
  • 60
  • 83
2
votes
3 answers

PHP's json_decode() with this JSON string

I have this JSON string: { "name": "test task1", "desc": "test desc1", "id": "1" }{ "name": "test task1aaaa", "desc": "test desc1", "id": "2" } But it looks like it's not correct (JSONLint tells me) so PHP's…
pmerino
  • 5,900
  • 11
  • 57
  • 76
2
votes
1 answer

Floating point zero (0000000000000000E+00) in JSON not parsed in jQuery (Windows) / JSONLint

I have a problem with a piece of JSON containing a float number of 0000000000000000E+00 (essentially zero). Consider, for example: { "a": 3199999999999999E+01, "b": 0000000000000000E+00, "c": 0, "d": 5 } The zero floating point…
mydoghasworms
  • 18,233
  • 11
  • 61
  • 95
2
votes
3 answers

JSON format failing on JSONLint

I'm writing some functions that construct what should be a properly formatted JSON string which I can then parse into a JSON object. My object is failing on JSONLint with the following error: syntax error, unexpected TINVALID at line 2 [ …
Joe
  • 4,852
  • 10
  • 63
  • 82
2
votes
2 answers

Online Auto-correct

Is there any good auto-correct JSON site you guys use? I've been using JSONLint. However, only validation is not enough for me, and I need it quite often. Simple correction is enough. Like correcting this: { Abc: abcd, '123': 123, kjlkj:…
Terri Si
  • 47
  • 1
  • 1
  • 4
2
votes
1 answer

PHP json_encode() results showing JSONLint errors

I am having issues with validating the output of my json_encode() function. I am pulling in an XML feed with cURL, converting it into an array, and converting that array into JSON with json_endode(). Ill spare you the cURL stuff: foreach…
robabby
  • 2,160
  • 6
  • 32
  • 47
2
votes
3 answers

SCRIPT1014: Invalid character

I have some JSON which is perfect when tested with jsonlint, but gives an Invalid character error when i try to parse it to an object. I've looked at the JSON string and it seems ok. How do I see funny characters that may be hidden?? here is the js…
1
vote
2 answers

Cannot deserialize some tweets using NewtonSoft.Json

Hi All, I am running a C# console app that is using the Twitter Stream API. My code is below JToken json = JObject.Parse(ResponseStream.ReadLine()); For every +- 20 tweets, I get the following error "Error reading JObject from JsonReader". I…
TYRONEMICHAEL
  • 4,174
  • 4
  • 30
  • 47
1
vote
1 answer

JSON.parse syntax error while JSONLint tell me that json string is valid

I used the PHP built-in function json_encode() to covert an object array to json string. Then I use AJAX method to get the xmlhttp.responseText. I use document.write(xmlhttp.responseText) to check the response string. For example, the string is as…
tomsawyer
  • 95
  • 1
  • 8
1
vote
0 answers

JSON UI Helper or JSON Lint with dropdown suggestions using a JSON schema

My client needs to have an USER interface where they can build a JSON The JSON is defined and validated by its schema For example, if you could go here https://developers.google.com/people/api/rest/v1/people/createContact This editor lets us define…
user16731842
  • 83
  • 1
  • 10
1
2 3 4