Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » How to convert JSON into TTCN-3(TITAN tool convert JSON TTCN3)
How to convert JSON into TTCN-3 [message #1805793] Wed, 24 April 2019 08:18 Go to next message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Hello,

I'm involve in some Multi-access Edge Computing (MEC) projects and there are a lot of JSON files I would like to convert in to TTCN-3 types modules.

I read all the threads regarding TITAN and JSON, but I didn't find such tool or compiler options to achieve my goals.

Please can you provide me some hint to do this JSON to TTCN-3 conversion?

Many thanks in advance for your help,

Best Regards,

Yann
Re: How to convert JSON into TTCN-3 [message #1805840 is a reply to message #1805793] Thu, 25 April 2019 09:15 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Yann,

currently there is no support in Titan to automate JSON to TTCN-3 conversion;
there is for the opposite direction though , which is probably more complex.

A conversion can be done manually, as described in the (simplistic) example
Using JSON in TTCN-3 and Titan Part I: Testing REST / JSON web services
https://www.eclipse.org/forums/index.php/t/1068704/

The recommended workflow is:

-The JSON document has to be found a JSON schema that covers it
-a TTCN3 type equivalent to this schema has to be found
-this type than can be used for variables that can be JSON encoded


Now probably this sounds more complicated than it really is .

JSON has only seven basic types:

-JSON Strings can be converted to TTCN-3 charstring or universal charstring
-JSON Numbers to TTCN-3 integers or float
-JSON Objects to TTCN-3 records or sets
-JSON Arrays to TTCN-3 arrays
-JSON boolean to TTCN-3 boolean
-JSON Null to the ASN.1 Null that can be imported into TTCN-3
JSON-Generic-Null-Def
DEFINITIONS ::=  BEGIN
  
  IMPORTS;
  
  JSON-null-type ::= NULL

END


The principles of TTCN-3 to JSON conversion are described in
the refguide
4.26.4. Converting TTCN-3 and ASN.1 types to a JSON schema

their inverse can be easily applied.

So one has to assemble the TTCN-3 equivalent, including the encoding variants, of the JSON documents to be converted. Once you have done one or two examples it should come naturally.


Of course the alternative is to write a script that does this automatically
but so far we did not find this justifiable.



Best regards
Elemer





Re: How to convert JSON into TTCN-3 [message #1805844 is a reply to message #1805840] Thu, 25 April 2019 09:49 Go to previous message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Hello Elemer,

Many thanks for your response.

Best Regards,

Yann
Previous Topic:TITAN ASN.1 compiler / BER decoder/ AUTOMATIC TAGS?
Next Topic:Add a library C/C++ into project Titan
Goto Forum:
  


Current Time: Fri Mar 29 05:38:59 GMT 2024

Powered by FUDForum. Page generated in 0.03322 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top