[x3d-public] How to tell if a file is JSON

John Carlson yottzumm at gmail.com
Mon Nov 23 15:19:19 PST 2015


I wonder if we should develop a X3D JSON parser which shows streaming
parsing of X3D JSON for large files.  Getting a large file which our
current tools don't support would be a good idea.
On Nov 23, 2015 5:11 PM, "John Carlson" <yottzumm at gmail.com> wrote:

> Don is correct from my reading.  Another thing you can do is parse the
> JSON, then insure the first *object* has an "X3D" key.  Good luck!
> On Nov 23, 2015 5:04 PM, "Don Brutzman" <brutzman at nps.edu> wrote:
>
>> On 11/20/2015 11:37 AM, Roy Walmsley wrote:
>>
>>> Hi Don and John,
>>>
>>> Sounds like you are making excellent progress on JSON.
>>>
>>
>> thanks.  updated the description page today, not many TODO items left.
>>
>>         http://www.web3d.org/x3d/stylesheets/X3dToJson.html
>>
>> So, I am just thinking ahead, to maybe one day getting JSON to load
>>> directly into my C++ Viewer. I am thinking of a loader, and asking myself
>>> the following question:
>>>
>>> Apart from the .json file extension, is there any other definitive way
>>> of determining that this is, or is not, a JSON X3D file. I am looking at
>>> your HelloWorld.json example, and seeing the text
>>>
>>>                                  { “X3D”: {
>>>
>>> on the first line. So, I’m thinking that the initial test that it is a
>>> JSON X3D file goes as follows:
>>>
>>> 1)Is the first character a left brace?
>>>
>>> 2)Ignoring white space, is the next token the quoted string “X3D”?
>>>
>>> 3)Ignoring white space, is the next token a colon?
>>>
>>> 4)Ignoring white space, is the next token a left brace?
>>>
>>
>> yes to all
>>
>> That is the equivalent of reading the header line. By the way, is it
>>> permitted to have white space before the first left brace?
>>>
>>
>> yes
>>
>> i went ahead and experimented with the Netbeans plugin JS CSS Minify
>> Compress, available via Netbeans/X3D-Edit Tools/Plugins menu and described
>> at
>>
>>         http://plugins.netbeans.org/plugin/49666/js-css-minify-compress
>>
>> this also showed that getting rid of all intermediate whitespace was OK.
>>
>> I guess  I just want to know that my thinking is not incorrect – double
>>> negative intended.
>>>
>>
>> no response   :)
>>
>> 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
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20151123/1e4512ad/attachment.html>


More information about the x3d-public mailing list