JSON: Difference between revisions

1 byte added ,  14 August 2019
m
Typo
m (change "Command")
m (Typo)
Line 77: Line 77:
When migrating data from JSON to a struct sometimes a member might be missing from the JSON data. For example because the element you are looking for is empty, so it has simply been omitted from the JSON. In that case the runtime will trigger a runtime error. You can disable that by setting the [https://docs.dataaccess.com/dataflexhelp/mergedProjects/VDFClassRef/cJsonObject-Property-pbRequireAllMembers.htm pbRequireAllMembers] property of the DataFlex Json object to false.
When migrating data from JSON to a struct sometimes a member might be missing from the JSON data. For example because the element you are looking for is empty, so it has simply been omitted from the JSON. In that case the runtime will trigger a runtime error. You can disable that by setting the [https://docs.dataaccess.com/dataflexhelp/mergedProjects/VDFClassRef/cJsonObject-Property-pbRequireAllMembers.htm pbRequireAllMembers] property of the DataFlex Json object to false.


If you need to deal with JSON which uses DataFlex reserved words in its member names (or other invalid values, such as those containing spaces in the example above: e.g "first name") then, since DataFlex 19.1, you can now use a valid name in your struct and assign a different name for the conversion via meta-data tags. This is sometimes referred to as the [https://docs.dataaccess.com/dataflexhelp/mergedProjects/Tools/Name_Meta-Data_Tag.htm altName member]
If you need to deal with JSON which uses DataFlex reserved words in its member names (or other invalid values, such as those containing spaces in the example above: e.g. "first name") then, since DataFlex 19.1, you can now use a valid name in your struct and assign a different name for the conversion via meta-data tags. This is sometimes referred to as the [https://docs.dataaccess.com/dataflexhelp/mergedProjects/Tools/Name_Meta-Data_Tag.htm altName member]


== External references ==
== External references ==