You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by "Greenberg, Gary" <gg...@visa.com> on 2019/04/15 22:05:38 UTC

Json validation

I know that Netbeans has a feature to validate XML files and I used it extensively when XML was main method to define requests and responses in REST API.
Nowadays JSON almost completely replaced XML in that role.
Is there a plugin or something to validate JSON or help to check it for errors?
I do have pretty big JSON file which somewhere contain an error, but cannot find it easily.
Netbeans marks the opening brace with an error flag, which tells me Token recognition at "
Going through it for ½ hour and can't spot any errors.
Gary Greenberg
Staff Software Engineer
Data Product Development, BI-A
E: ggreenbe@visa.com
M: 650-269-7902

[EmailSig-TaglineVersion]


Re: Json validation

Posted by Wade Chandler <wa...@apache.org>.
On Mon, Apr 22, 2019, 17:24 Mark Eggers <it...@yahoo.com.invalid>
wrote:

> On 4/16/2019 10:23 AM, Greenberg, Gary wrote:
> > I sure do have one. Here it is.
> >
>
> It looks like a BOM for UTF-8.
>

For further information on BOMs in JSON see
https://tools.ietf.org/html/rfc7159#section-8.1; not allowed; to tie the
loop.

Wade

Re: Json validation

Posted by Mark Eggers <it...@yahoo.com.INVALID>.
On 4/16/2019 10:23 AM, Greenberg, Gary wrote:
> I sure do have one. Here it is.
> 
> Gary Greenberg
> Staff Software Engineer
> Data Product Development, BI-A
> E: ggreenbe@visa.com
> M: 650-269-7902
> 
> [EmailSig-TaglineVersion]
> 
> From: Wade Chandler <wa...@apache.org>
> Sent: Monday, April 15, 2019 6:23 PM
> To: Greenberg, Gary <gg...@visa.com>
> Cc: users@netbeans.apache.org
> Subject: Re: Json validation
> 
> Pretty sure .json files themselves are validated like other file types; editor lot has it built in. Do you have a reproducible file you can share?
> 
> Wade
> 
> 
> On Mon, Apr 15, 2019, 18:06 Greenberg, Gary <gg...@visa.com>> wrote:
> I know that Netbeans has a feature to validate XML files and I used it extensively when XML was main method to define requests and responses in REST API.
> Nowadays JSON almost completely replaced XML in that role.
> Is there a plugin or something to validate JSON or help to check it for errors?
> I do have pretty big JSON file which somewhere contain an error, but cannot find it easily.
> Netbeans marks the opening brace with an error flag, which tells me Token recognition at “
> Going through it for ½ hour and can’t spot any errors.
> Gary Greenberg
> Staff Software Engineer
> Data Product Development, BI-A
> E: ggreenbe@visa.com<ma...@visa.com>
> M: 650-269-7902
> 
> [EmailSig-TaglineVersion]

It looks like a BOM for UTF-8.

Are you downloading this on a Windows machine, and is the file generated
on a non-Windows machine?

I have added -J-Dfile.encoding=UTF-8 to almost the end of my
netbeans_default_options in netbeans.conf. The end option is for bigger
fonts.

The error shows up as an unrecognizable (at least to me) character at
the beginning of the file. Delete that character and the file validates.

. . . just my two cents
/mde/


RE: Json validation

Posted by "Greenberg, Gary" <gg...@visa.com>.
I sure do have one. Here it is.

Gary Greenberg
Staff Software Engineer
Data Product Development, BI-A
E: ggreenbe@visa.com
M: 650-269-7902

[EmailSig-TaglineVersion]

From: Wade Chandler <wa...@apache.org>
Sent: Monday, April 15, 2019 6:23 PM
To: Greenberg, Gary <gg...@visa.com>
Cc: users@netbeans.apache.org
Subject: Re: Json validation

Pretty sure .json files themselves are validated like other file types; editor lot has it built in. Do you have a reproducible file you can share?

Wade


On Mon, Apr 15, 2019, 18:06 Greenberg, Gary <gg...@visa.com>> wrote:
I know that Netbeans has a feature to validate XML files and I used it extensively when XML was main method to define requests and responses in REST API.
Nowadays JSON almost completely replaced XML in that role.
Is there a plugin or something to validate JSON or help to check it for errors?
I do have pretty big JSON file which somewhere contain an error, but cannot find it easily.
Netbeans marks the opening brace with an error flag, which tells me Token recognition at “
Going through it for ½ hour and can’t spot any errors.
Gary Greenberg
Staff Software Engineer
Data Product Development, BI-A
E: ggreenbe@visa.com<ma...@visa.com>
M: 650-269-7902

[EmailSig-TaglineVersion]


RE: [EXT] RE: Json validation

Posted by "Thomson, Duncan" <du...@mitre.org>.
Here is your JSON file pasted straight into Netbeans, with some garbage added to show you error checking:

[cid:image002.png@01D4F461.A930F4F0]

From: Thomson, Duncan
Sent: Tuesday, April 16, 2019 2:32 PM
To: Greenberg, Gary <gg...@visa.com>; wadechandler@apache.org
Cc: users@netbeans.apache.org
Subject: RE: [EXT] RE: Json validation

You need to be clear whether you are talking about checking whether some text is legal JSON syntax, versus checking whether that text conforms to a JSON schema.

The Netbeans editor will already do the former on text in a .json file, but I think you are asking for the latter.

It’s important to use the terminology correctly to avoid confusion.  I think the term “validation” usually applies to the validation of content against a schema, but I’m not sure, so somebody please correct me if I’m using the terms incorrectly.

Anyway, if you simply google on JSON schema validation, you will find lots of discussion of how to do it.  I think you are asking whether any of these tools are built in to Netbeans, the way some the XML schema validation tools were (I think).    I think the answer is “no”.  My guess is that there may not be sufficient interest in JSON schema to merit this.

Also worth noting, XML schema lets you say things like: X must be a string, containing only upper case characters or a dollar sign character, except on a Tuesday, when it can contain an underscore.  OK, I made up that part about Tuesday, but my point is that XML schema allows one to be extremely prescriptive.  Not sure the same is possible in JSON schema.  Again, I may be wrong, so if so please correct me.  (Validating input against JSON schema is on my To Do List for a project I’m working on.)

Duncan

From: Greenberg, Gary <gg...@visa.com>>
Sent: Tuesday, April 16, 2019 1:24 PM
To: wadechandler@apache.org<ma...@apache.org>
Cc: users@netbeans.apache.org<ma...@netbeans.apache.org>
Subject: [EXT] RE: Json validation

I sure do have one. Here it is.

Gary Greenberg
Staff Software Engineer
Data Product Development, BI-A
E: ggreenbe@visa.com<ma...@visa.com>
M: 650-269-7902

[EmailSig-TaglineVersion]

From: Wade Chandler <wa...@apache.org>>
Sent: Monday, April 15, 2019 6:23 PM
To: Greenberg, Gary <gg...@visa.com>>
Cc: users@netbeans.apache.org<ma...@netbeans.apache.org>
Subject: Re: Json validation

Pretty sure .json files themselves are validated like other file types; editor lot has it built in. Do you have a reproducible file you can share?

Wade


On Mon, Apr 15, 2019, 18:06 Greenberg, Gary <gg...@visa.com>> wrote:
I know that Netbeans has a feature to validate XML files and I used it extensively when XML was main method to define requests and responses in REST API.
Nowadays JSON almost completely replaced XML in that role.
Is there a plugin or something to validate JSON or help to check it for errors?
I do have pretty big JSON file which somewhere contain an error, but cannot find it easily.
Netbeans marks the opening brace with an error flag, which tells me Token recognition at “
Going through it for ½ hour and can’t spot any errors.
Gary Greenberg
Staff Software Engineer
Data Product Development, BI-A
E: ggreenbe@visa.com<ma...@visa.com>
M: 650-269-7902

[EmailSig-TaglineVersion]


RE: [EXT] RE: Json validation

Posted by "Thomson, Duncan" <du...@mitre.org>.
You need to be clear whether you are talking about checking whether some text is legal JSON syntax, versus checking whether that text conforms to a JSON schema.

The Netbeans editor will already do the former on text in a .json file, but I think you are asking for the latter.

It’s important to use the terminology correctly to avoid confusion.  I think the term “validation” usually applies to the validation of content against a schema, but I’m not sure, so somebody please correct me if I’m using the terms incorrectly.

Anyway, if you simply google on JSON schema validation, you will find lots of discussion of how to do it.  I think you are asking whether any of these tools are built in to Netbeans, the way some the XML schema validation tools were (I think).    I think the answer is “no”.  My guess is that there may not be sufficient interest in JSON schema to merit this.

Also worth noting, XML schema lets you say things like: X must be a string, containing only upper case characters or a dollar sign character, except on a Tuesday, when it can contain an underscore.  OK, I made up that part about Tuesday, but my point is that XML schema allows one to be extremely prescriptive.  Not sure the same is possible in JSON schema.  Again, I may be wrong, so if so please correct me.  (Validating input against JSON schema is on my To Do List for a project I’m working on.)

Duncan

From: Greenberg, Gary <gg...@visa.com>
Sent: Tuesday, April 16, 2019 1:24 PM
To: wadechandler@apache.org
Cc: users@netbeans.apache.org
Subject: [EXT] RE: Json validation

I sure do have one. Here it is.

Gary Greenberg
Staff Software Engineer
Data Product Development, BI-A
E: ggreenbe@visa.com<ma...@visa.com>
M: 650-269-7902

[EmailSig-TaglineVersion]

From: Wade Chandler <wa...@apache.org>>
Sent: Monday, April 15, 2019 6:23 PM
To: Greenberg, Gary <gg...@visa.com>>
Cc: users@netbeans.apache.org<ma...@netbeans.apache.org>
Subject: Re: Json validation

Pretty sure .json files themselves are validated like other file types; editor lot has it built in. Do you have a reproducible file you can share?

Wade


On Mon, Apr 15, 2019, 18:06 Greenberg, Gary <gg...@visa.com>> wrote:
I know that Netbeans has a feature to validate XML files and I used it extensively when XML was main method to define requests and responses in REST API.
Nowadays JSON almost completely replaced XML in that role.
Is there a plugin or something to validate JSON or help to check it for errors?
I do have pretty big JSON file which somewhere contain an error, but cannot find it easily.
Netbeans marks the opening brace with an error flag, which tells me Token recognition at “
Going through it for ½ hour and can’t spot any errors.
Gary Greenberg
Staff Software Engineer
Data Product Development, BI-A
E: ggreenbe@visa.com<ma...@visa.com>
M: 650-269-7902

[EmailSig-TaglineVersion]


Re: Json validation

Posted by Wade Chandler <wa...@apache.org>.
Pretty sure .json files themselves are validated like other file types;
editor lot has it built in. Do you have a reproducible file you can share?

Wade


On Mon, Apr 15, 2019, 18:06 Greenberg, Gary <gg...@visa.com> wrote:

> I know that Netbeans has a feature to validate XML files and I used it
> extensively when XML was main method to define requests and responses in
> REST API.
>
> Nowadays JSON almost completely replaced XML in that role.
>
> Is there a plugin or something to validate JSON or help to check it for
> errors?
>
> I do have pretty big JSON file which somewhere contain an error, but
> cannot find it easily.
> Netbeans marks the opening brace with an error flag, which tells me *Token
> recognition at “*
>
> Going through it for ½ hour and can’t spot any errors.
>
> Gary Greenberg
>
> Staff Software Engineer
>
> Data Product Development, BI-A
>
> E: ggreenbe@visa.com
>
> M: 650-269-7902
>
>
>
> [image: EmailSig-TaglineVersion]
>
>
>