Topics

DITA XML to JSON conversion #JSON

patrick.wright73@...
 

Is anyone converting DITA to JSON format? I've seen OT plugins to convert JSON to DITA topics, and Oxygen (and other) single-file converters for JSON to DITA. But I'm curious if there is either a bulk conversion tool available (for DITA->JSON) or a toolkit plugin to convert a map's worth of topics. 

Thank you.
Pat

Zoë Lawson
 

Technically I am, but I’m doing something extremely specific.
We’re using a tour js (like hopscotch or bootstrap.js, but customized for our environment), so I’m only converting task topics and I’m really limiting what elements I’m using.

I don’t have anything really shareable. I think I started with a DITA to text transform, based on Robert Anderson’s http://metadita.org/toolkit/Morse.html

Zoë

Zoë Lawson


From: main@dita-users.groups.io <main@dita-users.groups.io> on behalf of patrick.wright73@... <patrick.wright73@...>
Sent: Monday, February 24, 2020 12:43:55 PM
To: main@dita-users.groups.io <main@dita-users.groups.io>
Subject: [dita-users] DITA XML to JSON conversion
 
Is anyone converting DITA to JSON format? I've seen OT plugins to convert JSON to DITA topics, and Oxygen (and other) single-file converters for JSON to DITA. But I'm curious if there is either a bulk conversion tool available (for DITA->JSON) or a toolkit plugin to convert a map's worth of topics. 

Thank you.
Pat

Zoë Lawson
 

Sorry, bad link. Try http://metadita.org/toolkit/morse.html

Zoë Lawson


From: main@dita-users.groups.io <main@dita-users.groups.io> on behalf of Zoë Lawson <zoelawson17@...>
Sent: Monday, February 24, 2020 3:08:54 PM
To: main@dita-users.groups.io <main@dita-users.groups.io>
Subject: Re: [dita-users] DITA XML to JSON conversion
 
Technically I am, but I’m doing something extremely specific.
We’re using a tour js (like hopscotch or bootstrap.js, but customized for our environment), so I’m only converting task topics and I’m really limiting what elements I’m using.

I don’t have anything really shareable. I think I started with a DITA to text transform, based on Robert Anderson’s http://metadita.org/toolkit/Morse.html

Zoë

Zoë Lawson

From: main@dita-users.groups.io <main@dita-users.groups.io> on behalf of patrick.wright73@... <patrick.wright73@...>
Sent: Monday, February 24, 2020 12:43:55 PM
To: main@dita-users.groups.io <main@dita-users.groups.io>
Subject: [dita-users] DITA XML to JSON conversion
 
Is anyone converting DITA to JSON format? I've seen OT plugins to convert JSON to DITA topics, and Oxygen (and other) single-file converters for JSON to DITA. But I'm curious if there is either a bulk conversion tool available (for DITA->JSON) or a toolkit plugin to convert a map's worth of topics. 

Thank you.
Pat

ekimber@contrext.com
 

Note that XSLT 3 (supported by recent Saxon versions, so including latest OT 2.x and 3.x versions) has features for reading and writing JSON, so if you know what the JSON should look like it shouldn't be too hard to generate it. There's also a generic JSON serialization option but it's unlikely it would provide satisfactory results due to the inherent difficulty in mapping from XML to JSON.

I think the larger challenge is probably knowing what the JSON should look like--that's going to be very specific to the consumer of the JSON.

Cheers,

Eliot
--
Eliot Kimber
http://contrext.com


On 2/24/20, 11:43 AM, "main@dita-users.groups.io on behalf of patrick.wright73@..." <main@dita-users.groups.io on behalf of patrick.wright73@...> wrote:

Is anyone converting DITA to JSON format? I've seen OT plugins to convert JSON to DITA topics, and Oxygen (and other) single-file converters for JSON to DITA. But I'm curious if there is either a bulk conversion tool available (for DITA->JSON) or a toolkit plugin to convert a map's worth of topics.

Thank you.
Pat

Nicholas Mucks
 

We convert dita to json so that a ditamap structure can feed a python app. It’s a lot like creating a text output.

What’s your json data structure?


Take care,
- Nick

Sent from mobile

On Feb 24, 2020, at 12:15 PM, "ekimber@..." <ekimber@...> wrote:

Note that XSLT 3 (supported by recent Saxon versions, so including latest OT 2.x and 3.x versions) has features for reading and writing JSON, so if you know what the JSON should look like it shouldn't be too hard to generate it. There's also a generic JSON serialization option but it's unlikely it would provide satisfactory results due to the inherent difficulty in mapping from XML to JSON.

I think the larger challenge is probably knowing what the JSON should look like--that's going to be very specific to the consumer of the JSON.

Cheers,

Eliot
--
Eliot Kimber
http://contrext.com


On 2/24/20, 11:43 AM, "main@dita-users.groups.io on behalf of patrick.wright73@..." <main@dita-users.groups.io on behalf of patrick.wright73@...> wrote:

Is anyone converting DITA to JSON format? I've seen OT plugins to convert JSON to DITA topics, and Oxygen (and other) single-file converters for JSON to DITA. But I'm curious if there is either a bulk conversion tool available (for DITA->JSON) or a toolkit plugin to convert a map's worth of topics.

Thank you.
Pat







despopoulos_chriss
 

@Zoë  Interesting...  That's exactly what we're doing.  We have a transform service that is part of our GUI app, and we give it a topic file and an XSLT file.  In the case of tours (we also customized them) we transform a task to JSON, where the intro section is the first tour panel, and then each task step is a specific tour panel.  We give metadata to the DITA that describes the HTML page the tour panel points to, and includes the CSS selector on that page to specifically point to a GUI item. 

What's neat is that we can single-source our docs not only as PDF and online help, but now micro-content.  We use the same transform service to give content to other embedded help panels that are tied to specific GUI widgets.  Because we pass the XSLT to the service, that means we can transform our content to whatever the display widget needs...  Be it XML, HTML, or JSON.  And we do it real-time, so we can use keyrefs and filter by audience, depending on the product flavor or brand that's currently running. 

Anyway, while it would be way specific, if you wanted to see our transforms we could share them...  It's nothing proprietary AFIK.  Like Zoë, we use a very limited subset of the DITA standard, and we do very specific things with it.  I think the first thing you would need to state is the scope of your problem.  How specific is the JSON you want, and how much of the DITA standard do you need to support?

patrick.wright73@...
 

Thank you for the comments and feedback.  Chris - what you describe is what we hope to accomplish. Provide microcontent (of a sort) to an application as XML and reuse that content in the future in other forms and more formal technical documents. The application prefers JSON, but was willing to convert from DITA XML if needed. The first type of DITA was simple glossary entries with nothing aside from term and definition.

Could I contact you off list? I'm at patrick.wright73@gmail and can use almost any video conference. Much appreciated.

Pat