Description


To export a component in a JSON stream, we have to flag each entity wjth the jsonClass=\"array\" tag before the statement strucToJson. For example, if we have to nested entities ENT1.MOD1 and ENT2.MOD2 we must do the following sequence of statement for having a valid JSON: componenttostruct lvS lvS->ENT1.MOD1->$tags->jsonClass=\"array\" lvS->ENT1.MOD1->OCC->ENT2.MOD1->$tags->jsonClass=\"array\" structtoJSON lvJSON, lvS We obtain the following JSON stream, which is correct: { \"ENT1.MOD1\" : [ { \"ENT2.MOD1\" : [ { \"F1\" : \"A\", \"F2\" : \"B\", \"F3\" : \"C\" }, { \"F1\" : \"D\", \"F2\" : \"E\", \"F3\" : \"F\" }, { \"F1\" : \"G\", \"F2\" : \"H\", \"F3\" : \"I\" } ] } ] }

Use Case


If we don\'t flag the entities, we got the following stream: { \"ENT1.MOD1\" : { \"OCC\" : { \"ENT2.MOD1\" : { \"OCC\" : { \"F1\" : \"A\", \"F2\" : \"B\", \"F3\" : \"C\" }, \"OCC\" : { \"F1\" : \"D\", \"F2\" : \"E\", \"F3\" : \"F\" }, \"OCC\" : { \"F1\" : \"G\", \"F2\" : \"H\", \"F3\" : \"I\" } } } } } When applying the javaScript function JSON.parse on this stream, we finally obtain this stream: { \"ENT1.MOD1\" : { \"OCC\" : { \"ENT2.MOD1\" : { \"OCC\" : { \"F1\" : \"G\", \"F2\" : \"H\", \"F3\" : \"I\" } } } } } Only the last occurrence of ENT2 is got.

Importance



Type


Proc Code

Operating System


Not Applicable

Status


Open

Leave a Reply