Skip to content

Unmarshalled object to JSON? #168

@sytolk

Description

@sytolk

It is written that this library can turn XML into JSON. I'm trying to write Node.js proxy that turn SOAP service into Rest (media JSON). And I have successful unmarshal XML response from SOAP service. The problem is that I cannot send JSON model from const unmarshall. unmarshall Object is:

nodeName: 'ns2:GetFuelStationsResponse',
  tagName: 'ns2:GetFuelStationsResponse',
  namespaceURI: 'http://schemas.mobility-media.com/wsdl/fuelprice/v1',
  prefix: 'ns2',
  localName: 'GetFuelStationsResponse',
  parentNode:  ...

How about to have method unmarshall.toJson() to extract values from this object?
This is my code:

const context = new Jsonix.Context([envelope, getFuelStationResponse]);
const unmarshaller = context.createUnmarshaller();

// Unmarshal the XML file
const unmarshall = unmarshaller.unmarshalString(xml);
//to get JSON string is not possible from  unmarshall
console.log(unmarshall.value.body.any[0].childNodes[0].childNodes[1].childNodes); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions