Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 522

jq rename nested json key and place under same key

$
0
0

I want to rename nested json key and keep under same schema.

Input:"properties": {"name": "Ram","age": "17","department": "Sony" }Code : jq '[.["properties.company"] = .properties.department| del(.properties.department)]'  file

Output:

"properties": {"name": "Ram","age": "17"   }"properties.company" = "Sony"

Expected Output should be :

"properties": {"name": "Ram","age": "17","company": "Sony"   }

What I am doing wrong ?


Viewing all articles
Browse latest Browse all 522

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>