Skip to content

Improve 'nil' values support #10

@jlescot

Description

@jlescot

I ran into a case where I created an Account on Recurly side, and when I get its details, I have the following as response (XML format):

<account>
    ...
    <first_name></first_name>
    <last_name nil="nil"></last_name>
    ...
</account>

which is then converted into (JSON format):

account: {
    ... 
    first_name: '',
    last_name: {
        $: {
            nil: "nil"
        }
    },
    ...
}

whereas I would expect something like:

account: {
    ... 
    first_name: '',
    last_name: null,
    ...
}

It seems that there is no standard convention to convert XML > JSON. BTW, I wonder whether the problem is linked to the library you are using to do the conversion (https://www.npmjs.org/package/xml2js) or whether it is an issue on Recurly side which should not return an XML element with a nil attribute (but instead omitting the element itself could be better...)

So any idea on this problem would be highly appreciated.

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