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

Is there a functionality to flatten/deflatten an object? #1228

Closed
moatazelmasry2 opened this issue May 25, 2015 · 5 comments
Closed

Is there a functionality to flatten/deflatten an object? #1228

moatazelmasry2 opened this issue May 25, 2015 · 5 comments

Comments

@moatazelmasry2
Copy link

Hi there,

I have the following object/array of objects:
Object1:

{ id: 2,
    balance: 130,
    'Issue :  { 
         'id': 1,
         'currency': 'EUR'
   }
}```

Object2: 
```json
{ id: 2,
    balance: 130,
    'Issue.id': 1,
    'Issue.currency': 'EUR'
}

Is there a way to 'deflatten' object1 into object2 and flatten object2 into object1?

Thanks

@jdalton
Copy link
Member

jdalton commented May 25, 2015

Hi @moatazelmasry2! We currently don't have a flatten for objects but I'm keeping an eye on the demand. Related to #1180.

@jdalton jdalton closed this as completed May 25, 2015
@moatazelmasry2
Copy link
Author

Hi John,

Would the two way implementation of something that might be interesting for lodash?
I need probably to implement this functionality anyway...

@jdalton
Copy link
Member

jdalton commented May 25, 2015

Check out flat.

@damianobarbati
Copy link

interesting one, somethings like the new native https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat but for objects.

@lock
Copy link

lock bot commented Jun 21, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants