vendredi 4 juillet 2014

postgres + json object to array


Vote count:

0




i would like to know if is possible to 'covnert' a json object to a json array to iterate over a mixed set of data.


i have a two rows that look like


{Data:{BASE:{B1:0,color:green}}} {Data:{BASE:[{B1:1,color:red},{B1:0,color:blue}]}}


i would like to extract the B1 val from all this rows, but i am a bit blocked :)


my first try was a json_extract_array, but fail on the 1st row (not an array) then my second try was a json_array_length with a case, but fail at the 1st row (not array)


can i handle this situation in any way? basically i need to extract all the rows where B1 > 0 in one of the json array (or object) and maybe return the node that contains B1 > 0



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire