[Info-vax] JSON, was: Re: First ship poll: When will the first native x86-64 compilers ship ?
Arne Vajhøj
arne at vajhoej.dk
Mon Apr 18 19:34:43 EDT 2022
On 4/18/2022 6:56 PM, Richard Maher wrote:
> 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:
>>>> 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".
>>> 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>
>
> What percentage of web services pass data via XML?
>
> A: Bugger all!
JSON is by far most common today.
But XML still happens.
And relative easy to support both with most frameworks (declarative).
Arne
More information about the Info-vax
mailing list