Skip to content

Handling array items #31

@jlguenego

Description

@jlguenego

I need to convert the following json into xml:

{
    "content": [
        {
            "_id": "012345678901234567890123",
            "lastname": "Guénégo",
            "firstname": "Jean-Louis"
        },
        {
            "_id": "5ae5ef542523d439d8083335",
            "lastname": "Phengsiaroun",
            "firstname": "Dany",
            "__v": 0
        }
    ]
}

The output does not satisfy because it does not clearly sepearate the array items:

<content>
    <_id>012345678901234567890123</_id>
    <lastname>Guénégo</lastname>
    <firstname>Jean-Louis</firstname>
    <_id>5ae5ef542523d439d8083335</_id>
    <lastname>Phengsiaroun</lastname>
    <firstname>Dany</firstname>
    <__v>0</__v>
</content>

I would suggest to add in the options something like:
handleArrayElement: true

that would produce:

<content>
    <item>
        <_id>012345678901234567890123</_id>
        <lastname>Guénégo</lastname>
        <firstname>Jean-Louis</firstname>
    </item>
    <item>
        <_id>5ae5ef542523d439d8083335</_id>
        <lastname>Phengsiaroun</lastname>
        <firstname>Dany</firstname>
        <__v>0</__v>
    <item>
</content>

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