serialize json
parent
1ce158ea0d
commit
1eaf25f777
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
read injson
|
||||
echo ${injson}|sed -e 's/"//g;s/,/\n/g;s/{/{\n/g;s/}/\n}/g'|awk -F ":" 'BEGIN{topic=""};/:{/{length(topic)>0 ? topic=topic$1"/" : topic=$1"/"};!/{/&&!/}/{print "\""topic$1"\":\""$2"\""};/}/{l=split(topic,t,"/");topic="";for(i=1;i<(l-1);i++)topic=topic""t[i]"/"}'
|
Loading…
Reference in New Issue