the recommended way to so this in 4D is to use JSON Validate.
http://doc.4d.com/4Dv17/4D/17/JSON-Validate.301-3730393.en.html

the structure of an object can be defined using a JSON schema,
a blueprint of a class of object, itself written in JSON.

kind of like what XSD or DTD are to XML.

https://en.wikipedia.org/wiki/XML_Schema_(W3C)
http://doc.4d.com/4Dv15/4D/15.6/DOM-Parse-XML-source.301-3817445.en.html

the type of value is far granular than native JSON,
you can have integer, date, etc.

you can specify value limitations (max, min, between),
use regex or simple wildcards.

it can even have internal cross references (a.k.a. JSON pointers).

essential reading:

https://blog.4d.com/validate-your-json-object/
https://blog.4d.com/a-new-tool-json-validator/
https://blog.4d.com/working-with-json-pointers/

2018/10/04 23:24、Chip Scheide via 4D_Tech 
<4d_tech@lists.4d.com<mailto:4d_tech@lists.4d.com>>のメール:

2 - For Objects, I would think that extending this idea to the object
itself would be useful, and valuable.
-- I would think that installing as the first property/value of the
object a definition of the contents of that object would allow for each
object to be 'self documenting' and might even lead to very generic
code. In this way you could blindly access the values in an object. Any
value in the object which is not 'documented' as part of Object.content
effectively would not exist.



**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to