You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I implement saving a complex object from Android to the Server.
The object is defined as object type on the server, and on Android is a Hashmap of subObjects, which are itself hashmaps.
I get an error : "Unprocessable Entity".
I have a Objet that is composed with subObjects that contains HashMaps members.
I deal with the code until the Object.toMap() return a JSON like file..... but still something wrong. What are the rules to extends Model with it own Object, especially when there is composition pattern.
{wineColor=1, id=Bouche:Equilibre, wineType=1, oenoLevel=1, instruction={what=Pas d information, how=Pas d information, why=Pas d information}, tripTag=Bouche:Equilibre}
When I update (replace = by : and adding ") this text to {
"wineColor":1,
"id":"Bouche:Equilibre",
"wineType":1,
"oenoLevel":1,
"instruction":
{
"what":"Pas d information",
"how":"Pas d information",
"why":"Pas d information"
},
"tripTag":"Bouche:Equilibre"}
and I put in the Loopback Explorer, this work with the API, but not from the Client
The SDK uses JsonUtil to convert from Java objects to JSON representation. See this unit-test for an example what is the correct way of creating nested object structures.
Try to enable ADB debug logs, the SDK is logging all request data via Log.d (source code). That way you should see what JSON was produced from your data.
I am afraid I don't have much time to investigate this. It would help me a lot if you could create a standalone app (LoopBack server, Android client) that I could run on my machine to reproduce the problem.
Activity
bajtos commentedon Jun 2, 2015
What have you tried so far? What were the results?
afaucogney commentedon Jun 16, 2015
Sorry, I didn"t get notified you answer me....
I get an error : "Unprocessable Entity".
I have a Objet that is composed with subObjects that contains HashMaps members.
I deal with the code until the Object.toMap() return a JSON like file..... but still something wrong. What are the rules to extends Model with it own Object, especially when there is composition pattern.
afaucogney commentedon Jun 16, 2015
When I logged Obj.toMap().toString(), I get
{wineColor=1, id=Bouche:Equilibre, wineType=1, oenoLevel=1, instruction={what=Pas d information, how=Pas d information, why=Pas d information}, tripTag=Bouche:Equilibre}
When I update (replace = by : and adding ") this text to {
"wineColor":1,
"id":"Bouche:Equilibre",
"wineType":1,
"oenoLevel":1,
"instruction":
{
"what":"Pas d information",
"how":"Pas d information",
"why":"Pas d information"
},
"tripTag":"Bouche:Equilibre"}
and I put in the Loopback Explorer, this work with the API, but not from the Client
afaucogney commentedon Jun 19, 2015
@bajtos any news or comment to help ?
bajtos commentedon Jun 19, 2015
The SDK uses JsonUtil to convert from Java objects to JSON representation. See this unit-test for an example what is the correct way of creating nested object structures.
Try to enable ADB debug logs, the SDK is logging all request data via
Log.d(source code). That way you should see what JSON was produced from your data.I am afraid I don't have much time to investigate this. It would help me a lot if you could create a standalone app (LoopBack server, Android client) that I could run on my machine to reproduce the problem.
jjhesk commentedon Jul 22, 2016
I would make it one flatten into string then using the string and pass it into the url. Using Gson to flatten the object and parse it into the url.