Decoding array-like jsons [message #1864807] |
Wed, 10 April 2024 11:19 |
Erwan Toux Messages: 6 Registered: March 2024 |
Junior Member |
|
|
Hello everyone,
I am currently running some tests on JSON messages.
The messages I am trying to send/receive look something like this:
[
some_integer,
"some_string",
"another_string",
{
keys : values
}
]
The TTCN3 associated would be:
type union u_myJsonType := {
integer int1,
charstring char1,
charstring char2,
my_dict_type dict
} with { variant "JSON : as value"; }
type record of u_myJsonType myJsonType;
Using unions makes it possible to send such JSON messages (as an array, without the keys for each value).
However when decoding, as specified in the ETSI json guide , on paragraph 7.2.10, this gets decoded in two char1 strings, instead of one char1 and one char2.
Is there a way to bypass this (knowing that the json messages will always be sent in the same order) ?
If not, from what I could read it would mean having to write my own CoDec, do you have any good resources on how to get started ?
Also, I quite dislike having to use a record of union type, as I am no longer able to call attributes of the object (i.e. I can't do myJsonType.char2). Any input on this ?
Thank you,
Best regards,
Erwan
|
|
|
|
Powered by
FUDForum. Page generated in 0.04495 seconds