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

First example in README does not match xmljson behavior version 0.2.1 #47

Open
chrisinmtown opened this issue Sep 1, 2020 · 1 comment

Comments

@chrisinmtown
Copy link

chrisinmtown commented Sep 1, 2020

The README offers the following sample XML input:

<employees>
    <person>
        <name value="Alice"/>
    </person>
    <person>
        <name value="Bob"/>
    </person>
</employees>

and JSON output:

{
    "employees": [{
        "person": {
            "name": {
                "@value": "Alice"
            }
        }
    }, {
        "person": {
            "name": {
                "@value": "Bob"
            }
        }
    }]
}

But I cannot reproduce that JSON output with version 0.2.1 (the latest), not with any of the -d options ('abdera', 'badgerfish', 'cobra', 'gdata', 'parker', 'xmldata', 'yahoo'). The option that yields the most similar output seems to be badgerfish, that produces the following list tagged "person" and containing objects that have the person data, which is a very different structure than what's shown in the README:

{
  "employees": {
    "person": [
      {
        "name": {
          "@value": "Alice"
        }
      },
      {
        "name": {
          "@value": "Bob"
        }
      }
    ]
  }
}

I didn't submit a PR correcting this because I don't know the real intent. I think the actual output is pretty confusing. Naively I expected minimal changes, with a list of "person" objects. That is arguably poor JSON (repeating the name every time) but it faithfully preserves the ugly XML input.

When the very first example is wrong, that makes the library fairly difficult to use or trust. Please reply, thanks.

@chrisinmtown chrisinmtown changed the title First example in README does not match xmljson behavior version 0.2.0 First example in README does not match xmljson behavior version 0.2.1 Sep 1, 2020
@chrisinmtown
Copy link
Author

The owner of this project, @sanand0, posted to #45 that he does not expect to respond to any issues before November 2020.

Repository owner deleted a comment from javadev May 15, 2023
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