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

Introduce isObject option for unpaired tags #630

Open
4 of 6 tasks
c100k opened this issue Jan 2, 2024 · 2 comments
Open
4 of 6 tasks

Introduce isObject option for unpaired tags #630

c100k opened this issue Jan 2, 2024 · 2 comments

Comments

@c100k
Copy link

c100k commented Jan 2, 2024

  • Are you running the latest version?
  • Have you included sample input, output, error, and expected output?
  • Have you checked if you are using correct configuration?
  • Did you try online tool?

Description

Unpaired tags are parsed into an empty string. But in some cases, it should be something else. Like an object for example.

In the same style of isArray, we could introduce an isObject option, working the same way.

Input

Let's take for example the following XML:

<Response>
    <id>123</id>
    <dataSet/>
</Response>

Code

https://naturalintelligence.github.io/fast-xml-parser/

Output

It gives the following output:

{
    "?xml": "",
    "Response": {
        "id": 123,
        "dataSet": ""
    }
}

expected data

I would instead expect the following result:

{
    "?xml": "",
    "Response": {
        "id": 123,
        "dataSet": {}
    }
}

Would you like to work on this issue?

  • Yes
  • No

Bookmark this repository for further updates. Visit SoloThought to know about recent features.

Copy link

github-actions bot commented Jan 2, 2024

We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.

@amitguptagwl
Copy link
Member

I've took care of this in v5.

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

2 participants