[x3d-public] JSON validation

Don Brutzman brutzman at nps.edu
Mon Mar 6 15:32:22 PST 2017


Andreas, thanks for the example jsonlint test link.

Am happy to report that jsonlint check links have been added for all of the 3884 .json links in the X3D Examples Archives.

	http://www.web3d.org/x3d/content/examples/X3dResources.html#Examples

Sample:

	http://www.web3d.org/x3d/content/examples/Basic/CAD/CatiaHubAssemblyCombinedIndex.html

	http://www.web3d.org/x3d/content/examples/Basic/CAD/CatiaHubAssemblyCombined.json

	http://jsonlint.com/?json=http://www.web3d.org/x3d/content/examples/Basic/CAD/CatiaHubAssemblyCombined.json

So far it looks excellent.  This will facilitate further refinement.

Found one problem scene (taken from specification) which includes intentionally challenging quotations:

	http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/X3dHeaderPrototypeSyntaxExamples.x3d

	http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/X3dHeaderPrototypeSyntaxExamplesIndex.html

	http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/X3dHeaderPrototypeSyntaxExamples.json

	http://jsonlint.com/?json=http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/X3dHeaderPrototypeSyntaxExamples.json

=============================================
Error: Parse error on line 231:
... "#comment": "alternative: Text s
-----------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
=============================================

Line 231 is the comment in the following block:

"Shape": {
	"-geometry": {
		"Text": {
			"@string": ["He said, \"Immel did it!\""]
		}
	},
	"-children": [{
		"#comment": "alternative: Text string='\"He said, \"Immel did it!\"\"'"
	}],
	"-appearance": {
		"Appearance": {
			"-material": {
				"Material": {}
			}
		}
	}
}

Original .x3d form:

<Shape containerField='proxy'>
	<Text string='"He said, \"Immel did it!\""'/>
	<!-- alternative: Text string='"He said, \"Immel did it!\""' -->
	<Appearance>
		<Material/>
	</Appearance>
</Shape>

So the Text MFString is handled OK but the comment is not.  Shouldn't be hard to fix, will look at that.

Other than that, haven't found problems.  No doubt you have found a few others John!  Still, quality assurance continues to improve.

	X3D Resources: Quality Assurance
	http://www.web3d.org/x3d/content/examples/X3dResources.html#QualityAssurance

Have fun with X3D JSON!


On 2/16/2017 1:25 PM, Andreas Plesch wrote:
> Great. At some point it may be possible to avoid jsonlint.com <http://jsonlint.com> and integrate into web3d.org <http://web3d.org> using
>
> https://github.com/circlecell/jsonlintdotcom <https://github.com/circlecell/jsonlintdotcom>
>
> The validation apparently happens on the client browser anyways using javascript https://github.com/zaach/jsonlint
>
>
> Another validation service:
>
> https://jsonformatter.curiousconcept.com/#http%3A%2F%2Fwww.web3d.org%2Fx3d%2Fcontent%2Fexamples%2FBasic%2Fdevelopment%2FSchemaTest.json
>
> -Andreas
>
>
> On Thu, Feb 16, 2017 at 2:19 PM, Don Brutzman <brutzman at nps.edu <mailto:brutzman at nps.edu>> wrote:
>
>     Perfect, thanks Andreas!  I will incorporate that feature in the next revision of example archives.  8)
>
>     On 2/15/2017 8:33 PM, Andreas Plesch wrote:
>
>         If just the JSON itself needs to be validated, jsonlint already accepts URLs as a parameter:
>
>         http://jsonlint.com/?json=http%3A%2F%2Fwww.web3d.org%2Fx3d%2Fcontent%2Fexamples%2FBasic%2Fdevelopment%2FSchemaTest.json <http://jsonlint.com/?json=http%3A%2F%2Fwww.web3d.org%2Fx3d%2Fcontent%2Fexamples%2FBasic%2Fdevelopment%2FSchemaTest.json>
>
>         leads to a validation. Might be useful for trickier cases (escaping, quoting ..) . The colon and forward slashes should be easy to replace in any example URL.
>
>         This of course does not take into account a x3d schema.
>
>         Andreas
>
>         On Feb 15, 2017 9:06 PM, <x3d-public-
>
>             Date: Wed, 15 Feb 2017 17:31:50 -0800
>             From: Don Brutzman <brutzman at nps.edu <mailto:brutzman at nps.edu> <mailto:brutzman at nps.edu <mailto:brutzman at nps.edu>>>
>             To: <yottzumm at gmail.com <mailto:yottzumm at gmail.com> <mailto:yottzumm at gmail.com <mailto:yottzumm at gmail.com>>>
>             Cc: X3D Graphics public mailing list <x3d-public at web3d.org <mailto:x3d-public at web3d.org> <mailto:x3d-public at web3d.org <mailto:x3d-public at web3d.org>>>
>             Subject: Re: [x3d-public] ClassCastException in X3DJSAIL. Probably
>                     okay, since it's a test program.
>             Message-ID: <bb83585f-9890-9871-8c3b-de990f24ca7d at nps.edu <mailto:bb83585f-9890-9871-8c3b-de990f24ca7d at nps.edu> <mailto:bb83585f-9890-9871-8c3b-de990f24ca7d at nps.edu <mailto:bb83585f-9890-9871-8c3b-de990f24ca7d at nps.edu>>>
>             Content-Type: text/plain; charset="utf-8"; format=flowed
>
>             ... mm, can you figure out a way to link a scene url into a json validator url?  for example, something that combines
>
>                     http://jsonlint.com/
>             with
>                     http://www.web3d.org/x3d/content/examples/Basic/development/SchemaTest.json <http://www.web3d.org/x3d/content/examples/Basic/development/SchemaTest.json> <http://www.web3d.org/x3d/content/examples/Basic/development/SchemaTest.json <http://www.web3d.org/x3d/content/examples/Basic/development/SchemaTest.json>>
>
>             if so, i can add such validation-convenience links to each index page in the archives...
>
>
>
> --
> Andreas Plesch
> 39 Barbara Rd.
> Waltham, MA 02453


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list