I'm trying to read a json file in python and I want to break a long value into multiples lines to make it easier to read it.
e.g JSON file:
mem
's value is too long, so I'd like to make it multiple lines.
{
"resource":{
"cpu": ["host, usage_system, usage_user, usage_iowait", "1=1"],
"mem": ["host, active/(1024*1024) as active, available/(1024*1024) as available, available_percent, buffered/(1024*1024) as buffered, cached/(1024*1024) as cached, swap_cached/(1024*1024) swap_cached, swap_total/(1024*1024) swap_total, total/(1024*1024) mem_total, used/(1024*1024) mem_used", "1=1"],
"net": ["host, bytes_recv, bytes_sent, packets_recv, packets_sent", "1=1 and interface != 'all'"]
}
}
I want to make the value like below.
{ "resource":{
"cpu": ["host, usage_system, usage_user, usage_iowait", "1=1"],
"mem": ["host, active/(1024*1024) as active, available/(1024*1024) as available,
available_percent, buffered/(1024*1024) as buffered,
cached/(1024*1024) as cached, swap_cached/(1024*1024) swap_cached,
swap_total/(1024*1024) swap_total,
total/(1024*1024) mem_total, used/(1024*1024) mem_used", "1=1"],
"net": ["host, bytes_recv, bytes_sent, packets_recv, packets_sent", "1=1 and interface != 'all'"]
}
}
Thanks!