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

What is the behavior if a JSON path is an array, object or literal in different cases? #14

Closed
jpmckinney opened this issue Dec 15, 2021 · 3 comments

Comments

@jpmckinney
Copy link
Contributor

I expect an error as behavior is undefined – but better if the error is human-readable and clear to a user.

@jpmckinney
Copy link
Contributor Author

jpmckinney commented Dec 15, 2021

If the path is inconsistent across top-level objects, it works as follows:

[
    {
        "foo": "bar"
    },
    {
        "foo": {
            "baz": "bzz"
        }
    },
    {
        "foo": [
            {
                "zzz": 1
            }
        ]
    }
]

yields:

main.csv

_link,_link_main,foo,foo_baz
1,1,bar,
2,2,,bzz
3,3,,

foo.csv

_link,_link_main,zzz
3.foo.0,3,1

Inconsistency across deeper objects yields the same as above (with different files and link columns):

[
    {
        "array": [
            {
            "foo": "bar"
            },
            {
                "foo": {
                    "baz": "bzz"
                }
            },
            {
                "foo": [
                    {
                        "zzz": 1
                    }
                ]
            }
        ]
    }
]

@kindly
Copy link
Owner

kindly commented Dec 16, 2021

More work needs to be done on documenting output format. #5

However, the above is intended behaviour as I wanted to accept the most amount of possible input data, even with inconsistant keys. Probably a warning would be useful though.

@kindly
Copy link
Owner

kindly commented Dec 22, 2021

Closing not fixed will be part of #5.

@kindly kindly closed this as completed Dec 22, 2021
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