Re: Was there any other reason to start some properties with @ than to make it harder to generate the JSON?!?

čt 29. 2. 2024 v 9:07 odesílatel Jan Krynicky <jan.krynicky@linksoft.cz>
napsal:

> The subject says it all.
>
> This "thing" is insanely overcomplicated and overdesigned as it is, but
> whose bright idea was it to invent the "@type" and "@content"?!?
>
> For crying out loud, you supposedly chose JSON so that people could build
> the structure in some other language and then serialize the object into
> JSON and include it on a page or something and then you invent this?
>
> HOW AM I SUPPOSED TO HAVE A PROPERTY NAMED @type IN C#?
>
> Yes, I know I can first generate the JSON with sane, doable property names
> and then search and replace to get your insane, idiotic "@type".
>

It was designed to avoid name clashes.  Folks legitimately want to use
terms like "type" and "id" in other contexts.  So the "@" was introduced so
as not to pollute the namespace.

It works well enough in most languages, I wasnt aware of the C#
limitation.  There's a workaround in PHP and I suspect probably is one in
C# too, perhaps you could give an example, then we could see if there's a
workaround.


>
> Jenda
>

Received on Sunday, 3 March 2024 14:41:22 UTC