Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add multiple children, some with the same name #18

Closed
harm-meijer opened this issue Nov 16, 2020 · 1 comment
Closed

How to add multiple children, some with the same name #18

harm-meijer opened this issue Nov 16, 2020 · 1 comment

Comments

@harm-meijer
Copy link

When I parse the following:

{
  Index: {
    "#": [{ A: 1 }, { A: 2 }, { B1 }],
  },
};

I get:

<Index>
  <A>1</A>
</Index>
<Index>
  <A>2</A>
</Index>
<Index>
  <B>1</B>
</Index>

I would like to get the following xml:

<Index>
  <A>1</A>
  <A>2</A>
  <B>1</B>
</Index>

But can't figure out how to do this.

@harm-meijer
Copy link
Author

This one is solved, used the following object to get desired xml:

{
  Index: {
    A: [1, 2],
    B: 1,
  },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant