Skip to content

Iterate through every key, value; even inner childs. Get full path of a key #120

Open
@cptspartano

Description

Hi! I've got two simple questions:

1.- Imagine you have a JSON with some inner childs being another object, and some others inner inner childs being objects, and so on. Is there any way this package can iterate autonomously to get to all the simple key, value pairs of the JSON (meaning by simple value anyone that is not another object). For example, with a functioncall. I was trying to do it manually but I was ending with a lot of loops inside loops. My main need is to compare those simple key, value pairs between two JSON (in the way that both JSON should follow the same structure, but anyone could have some fields missing.

2.- Followed by the previous one, another question I have is: Given a key, it is possible to recover its full path, especially interested if it is from an inner (or inner inner, or inner inner inner, or...) child? That way I could assure in a way that I'm comparing the same childs between those two JSON.

I don't know if my questions are clear or not. Thanks in advance!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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