#1 2022-12-14 12:13:02

eraldo
Member
From: Brasil
Registered: 2010-07-22
Posts: 69
Website

Invalid Json

This json, according to RFC 8259, is valid:

{field:"none",-1:"down",2:"up"}

But it doesn't pass in mORMot2

Offline

#2 2022-12-14 13:28:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,231
Website

Re: Invalid Json

This is no valid JSON.
Even this RFC defines an object as  member = string name-separator value
So the field name should be a string. And the RFC states that " A string begins and ends with quotation marks. "
For instance, no browser would be able to parse it.
See https://www.json.org/json-en.html

The mORMot parser can understand some "extended" JSON, as used in MongoDB, with unquoted alphanumerical field names, but not being numbers.
Even from JavaScript, {field:"none",1:"down",2:"up"} is accepted, but {field:"none",-1:"down",2:"up"} is not. And this is JavaScript, not JSON.

Offline

Board footer

Powered by FluxBB