Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Paolo F Cantoni on March 07, 2017, 05:42:35 pm

Title: JSON Importer?
Post by: Paolo F Cantoni on March 07, 2017, 05:42:35 pm
I know EA can generate JSON, but is there a way to import JSON directly into EA?

Can it be done indirectly (e.g. JASON -> XSD -> EA)?  If so, what tools are recommended?

TIA,
Paolo
Title: Re: JSON Importer?
Post by: Geert Bellekens on March 07, 2017, 05:57:32 pm
You could write one yourself.
We've done some work on parsing source files and translating them to EA elements recently (all open source) for DDL (part of of the EA Database Transformer (https://bellekens.com/ea-database-transformer/) and Cobol copybooks (part of the EA Mapping addin (https://bellekens.com/ea-mapping/)

It should be pretty easy to extend that for the JSON syntax.
See
- https://github.com/GeertBellekens/cobol-object-mapper
- https://github.com/GeertBellekens/DDL-Parser

Both are based on the generic Human Parser Generator (https://github.com/christophevg/human-parser-generator)

Geert

PS. Or yo can of course outsource the development to my company, I'd be happy to provide you with a quote for a JSON parser  ;)


Title: Re: JSON Importer?
Post by: Eve on March 08, 2017, 09:09:49 am
No, I'm not aware of anything to import JSON into EA.

Given your comment about transforming to XSD and then importing, can I assume that you are in fact referring to a JSON schema?

Not sure about JASON, can't find anything that seems relevant on that. I know our schema composer generates JSON Schema (http://json-schema.org/) files. So at least that would be a candidate for importing.
Title: Re: JSON Importer?
Post by: Paolo F Cantoni on March 08, 2017, 09:40:02 am
No, I'm not aware of anything to import JSON into EA.

Given your comment about transforming to XSD and then importing, can I assume that you are in fact referring to a JSON schema?

Not sure about JASON, can't find anything that seems relevant on that. I know our schema composer generates JSON Schema (http://json-schema.org/) files. So at least that would be a candidate for importing.
Yes, Simon,

I WAS referring to a JSON schema (I believe). As you might tell, my knowledge of JSON is limited.  We've been provided with some REST APIs with JSON definitions and are wanting to import them into EA.

Paolo
Title: Re: JSON Importer?
Post by: Eve on March 08, 2017, 03:10:03 pm
Ah, the standard requirements management issue. Getting to know what users need without them knowing themselves.

Stepping beyond the JSON, what you're probably after is a model of the REST api and not just the schema of each request and response. If it's well designed, all of those requests and responses probably take the form of subsets of a core data model for the service. In that case the ideal would be to import schema composer profiles, the base data model, and a list of each request path and the possible response types (including http status codes)

 It's a request I have seen before, but there's nothing built in to EA to do it.

PS. JSON is like this... XML is too complicated. Let's make a new format that's easier to read and doesn't have all those nasty schemas etc. A few months later... How can we specify what we expect in a JSON message? Let's create a way of specifying that. A few years later... JSON is too complicated.  :-X
Title: Re: JSON Importer?
Post by: Paolo F Cantoni on March 08, 2017, 05:59:58 pm
[SNIP]

PS. JSON is like this... XML is too complicated. Let's make a new format that's easier to read and doesn't have all those nasty schemas etc. A few months later... How can we specify what we expect in a JSON message? Let's create a way of specifying that. A few years later... JSON is too complicated.  :-X
Yes, I'd already gathered that!  ;)

Paolo
Title: Re: JSON Importer?
Post by: Paolo F Cantoni on March 08, 2017, 06:06:35 pm
Stepping beyond the JSON, what you're probably after is a model of the REST api and not just the schema of each request and response. If it's well designed, all of those requests and responses probably take the form of subsets of a core data model for the service. In that case the ideal would be to import schema composer profiles, the base data model, and a list of each request path and the possible response types (including http status codes)

 It's a request I have seen before, but there's nothing built into EA to do it.
These are 3rd party product developers.  Data model?  What's a data model?  They can't even give me a CSV of the REST APIs.  All they can give me is a Swagger JSON output file.

Any other options to get that into EA?

Paolo
Title: Re: JSON Importer?
Post by: Glassboy on March 09, 2017, 07:55:06 am
PS. JSON is like this... XML is too complicated. Let's make a new format that's easier to read and doesn't have all those nasty schemas etc. A few months later... How can we specify what we expect in a JSON message? Let's create a way of specifying that. A few years later... JSON is too complicated.  :-X

The phrase I have heard most often is "we had xml serialization issues, so we switched to json".
Title: Re: JSON Importer?
Post by: Eve on March 09, 2017, 09:03:19 am
All they can give me is a Swagger JSON output file.
Yep. Had several requests for import of swagger files. Seems to be pretty common for developers of REST APIs.

PS. Incidentally, swagger isn't in JSON although it often embeds it, the base format is in fact YAML.
Title: Re: JSON Importer?
Post by: Glassboy on March 09, 2017, 09:43:54 am
All they can give me is a Swagger JSON output file.
Yep. Had several requests for import of swagger files. Seems to be pretty common for developers of REST APIs.

PS. Incidentally, swagger isn't in JSON although it often embeds it, the base format is in fact YAML.

And YAML is a human readable format. (or should be)
Title: Re: JSON Importer?
Post by: Paolo F Cantoni on March 09, 2017, 10:35:31 am
All they can give me is a Swagger JSON output file.
Yep. Had several requests for import of swagger files. Seems to be pretty common for developers of REST APIs.

PS. Incidentally, swagger isn't in JSON although it often embeds it, the base format is in fact YAML.
As I said, my knowledge of JSON is extensive (ly lacking). ;)

Should I submit a formal request, since it does seem to be increasingly common or is it already in the pipeline due to previous requests?

Paolo
Title: Re: JSON Importer?
Post by: MatthiasVDE on May 11, 2017, 11:59:40 pm
Paolo, what's the status about this?

I'm dealing with the same problem  :)
Title: Re: JSON Importer?
Post by: Paolo F Cantoni on May 12, 2017, 09:37:57 am
Hi Matthias,

No real progress that I'm aware of.  It would not hurt for you to put in a formal feature request also.

Paolo
Title: Re: JSON Importer?
Post by: PhilippeWolkowicz on January 18, 2019, 06:57:49 pm
is there anything new regarding this subject? Did somebody work on a solution?
Title: Re: JSON Importer?
Post by: qwerty on January 18, 2019, 07:43:42 pm
@Philippe You should stick with Geerts suggestion: write your own. I guess it would not take me longer than 15 minutes with a basic Python script.

q.
Title: Re: JSON Importer?
Post by: Guillaume on January 25, 2019, 09:21:41 pm
Hi,
I recently dealt with JSON files that described published Data Models. I managed to import them into EA from the CSV format having used a handy and free Excel addin: PowerQuery. It lets you define Queries on JSON. It can be a bit complicated to get into.