[Info-vax] JSON, was: Re: First ship poll: When will the first native x86-64 compilers ship ?
Richard Maher
maher_rjSPAMLESS at hotmail.com
Mon Apr 18 18:56:42 EDT 2022
On 18/04/2022 8:06 pm, Arne Vajhøj wrote:
> On 4/18/2022 4:35 AM, Jan-Erik Söderholm wrote:
>> Den 2022-04-18 kl. 01:27, skrev Arne Vajhøj:
>>> On 4/17/2022 6:55 PM, Simon Clubley wrote:
>>>> Having said that, I do think that sometimes people do go overboard in
>>>> using whatever is the fashion of the month instead of just a nice
>>>> simple
>>>> parser that maybe just builds an object tree that you can iterate
>>>> through
>>>> to extract the data you need.
>>>
>>> If you use JSON then you do not need to write that parser but can
>>> just pick one and use it - for almost all languages - and for
>>> the more popular languages there are multiple parsers to choose from.
>>
>> We have some Cobol cases where the data sent to "the other side"
>> was defined as JSON. The structure was fixed and the data parts
>> all had known and fixed sizes (or could be blank filled), so it
>> was easy enough to define the JSON structure as a Cobol record
>> with variables for the data parts and just "fill-in-the-blanks".
>>
>> I guess that you could call that "a astring". With a special format
>> but still a (kind of) string.
>>
>> For some cases (the recevier requested UUID version 4 while VMS
>> only supports Version 1), so we used Python and the JSON support
>> it has. On the communication channel (an MQ queue) it is still
>> a string of characters.
>>
>> And in another case we got an XML structure, but it had a very
>> well known format so the data we needed could just be fetched
>> from well know positions in that "XML string".
>>
>> So you can very well use JSON or XML *in specific cases*
>> without the fancy parsers.
>>
>> I'm not against parsers, of course. In another case we receive
>> a large and very dynamic XML structure and there the parsing
>> and looping constructs in Python was very handy to read it.
>
> A parser that actually understand the rules of JSON/XML is
> way more robust than a hack.
>
> But obviously one need to do what one need to do. There are
> no free JSON parser/generator for Cobol listed at json.org (one
> commercial though).
>
> Especially XML can be tricky.
>
> 3 years ago for another thread I created this monstrosity:
>
> <a xmlns:df='http://df2'><b
> xmlns='http://df1'><x><![CDATA[ABC<x></x>]]></x></b><c
> xmlns='http://df2'><x><![CDATA[DEF<x></x>]]></x></c><c
> xmlns='http://df3'><x><![CDATA[GHI<x></x>]]></x></c><df:c><df:x><![CDATA[JKL<x></x>]]></df:x></df:c></a>
>
>
> Arne
>
What percentage of web services pass data via XML?
A: Bugger all!
More information about the Info-vax
mailing list