Json Return and Query

0 votes
Hello, I want to know how to query this type of json which is  Storage Service,
and add items separately in "parcela 01" or "parcela 02"
 
: json :
{

"id": {
    
    "parcela 01": { 
           "variavel1": [30,501,40],
            "variavel2": [30]
    },

    "parcela 02": {
        "variavel1": [30,501,40],
         "variavel2": [40]
    }

}
} 

 

thank you

 

 
 
asked Oct 21, 2017 in Unity by s.rodriguesflp (16 points)

1 Answer

+1 vote
 
Best answer

Hi  s.rodriguesflp,

Apologies for getting late back to you. 
 

Thanks for sharing the JSON which you have stored in No-SQL database, before helping you with your query just wanted to let you know that querying on values stored as an array is not possible. You can either store those values as string/integer to fetch it using the query and how you can fetch it in nested JSON. 

You can simply create your query and pass the key as "id.parcela.variavel2"  in your JSON and value on which you want to query using the EQUAL, LIKE, GREATER THAN or LESS THAN etc. 

Regarding the addition to your document, you can append the value using the update functions of No-SQL Storage service. Please have a look at this link and let us know if you required any help from our side.

 

Regards,

Himanshu Sharma

answered Oct 23, 2017 by hs00105 (2,005 points)
selected Oct 26, 2017 by s.rodriguesflp
Thanks for the feedback.

I thought about what you said to me, so the next question came up, if you can help me.

Basically I need to add one more item in a JSON Doc, without having to retune with the whole object and make an update.

JSON ORIGINAL
{
     "id": "11111111.parcela01",
     "object1": [
         12,
         3,
         5
}

I would make a query with the "id" = "11111111.parcela01" and add
this item.

"object2": [
         122,
         33,
         154]


JSON result

{
     "id": "11111111.parcela01",
     "object1": [
         12,
         3,
         5],
     "object2": [
         122,
         33,
         154]
}

I want to know if it's possible.

Thank you in advance.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...