Manage complex object keys in depth.
npm install json-object-keys
import { remove } from 'json-object-keys'
remove(
{
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29
},
'category'
)
Output
+{
+ id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
- category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
+ email: '[email protected]',
+ age: 29
+}
import { remove } from 'json-object-keys'
remove(
{
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29,
node: [
{
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29,
node: {
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29,
node: {
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29
}
}
},
{
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29,
node: {
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29
}
},
{
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29,
node: {
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29,
node: {
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29
}
}
}
]
},
'id'
)
Output
+{
- id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
+ category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
+ email: '[email protected]',
+ age: 29,
+ node: [
+ {
- id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
+ category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
+ email: '[email protected]',
+ age: 29,
+ node: {
- id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
+ category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
+ email: '[email protected]',
+ age: 29,
+ node: {
- id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
+ category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
+ email: '[email protected]',
+ age: 29
+ }
+ }
+ },
+ {
- id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
+ category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
+ email: '[email protected]',
+ age: 29,
+ node: {
- id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
+ category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
+ email: '[email protected]',
+ age: 29
+ }
+ },
+ {
- id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
+ category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
+ email: '[email protected]',
+ age: 29,
+ node: {
- id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
+ category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
+ email: '[email protected]',
+ age: 29,
+ node: {
- id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
+ category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
+ email: '[email protected]',
+ age: 29
+ }
+ }
+ }
+ ]
+}
import { remove } from 'json-object-keys'
remove(
{
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29
},
['category', 'email']
)
Output
+{
+ id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
- category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
- email: '[email protected]',
+ age: 29
+}
import { remove } from 'json-object-keys'
remove(
{
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29,
node: [
{
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29,
node: {
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29,
node: {
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29
}
}
},
{
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29,
node: {
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29
}
},
{
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29,
node: {
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29,
node: {
id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
name: 'John Doe',
category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
email: '[email protected]',
age: 29
}
}
}
]
},
['email', 'category', 'age']
)
Output
+{
+ id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
- category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
- email: '[email protected]',
- age: 29,
+ node: [
+ {
+ id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
- category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
- email: '[email protected]',
- age: 29,
+ node: {
+ id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
- category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
- email: '[email protected]',
- age: 29,
+ node: {
+ id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
- category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
- email: '[email protected]',
- age: 29
+ }
+ }
+ },
+ {
+ id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
- category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
- email: '[email protected]',
- age: 29,
+ node: {
+ id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
- category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
- email: '[email protected]',
- age: 29
+ }
+ },
+ {
+ id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
- category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
- email: '[email protected]',
- age: 29,
+ node: {
+ id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
- category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
- email: '[email protected]',
- age: 29,
+ node: {
+ id: 'e059d01a-7082-4b63-9c70-997491cdcf7c',
+ name: 'John Doe',
- category: '65bf5579-710d-4f56-9907-8c0bb1b2f0d2',
- email: '[email protected]',
- age: 29
+ }
+ }
+ }
+ ]
+}
This project is licensed under the MIT License.