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

Flatten primary object key option for JTask::Convert #13

Open
adammcarth opened this issue Apr 12, 2014 · 0 comments
Open

Flatten primary object key option for JTask::Convert #13

adammcarth opened this issue Apr 12, 2014 · 0 comments

Comments

@adammcarth
Copy link
Owner

JSON files which don't use id numbers as a primary key (most of them) will more often than not have one that would make more sense if merged with its child (flattened) when an id is added in JTask::Convert.from_json.

employees.json

"John Doe": {
  "email": "[email protected]",
  "title": "CEO"
}
JTask::Convert.from_json("employees.json")

Current JTask Conversion:

"1": {
  "John Doe": {
    "email": "[email protected]",
    "title": "CEO"
  }
}

Seems a little stupid now, doesn't it? JTask::Convert should offer an option to flatten the parent key and merge it under a new key in it's child. Something like this...

"1": {
  "name": "John Doe",
  "email": "[email protected]",
  "title": "CEO"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant