If you have questions or if you want to share your opinion about Aware IM post your message on this forum
#52354 by bondicoffee
Wed Dec 11, 2019 2:05 am
Following is the response recieved from a REST service in JSON Format.
{
"data": [
{
"fieldname" : ["value1","value2"]
}
]
}
Following is my implementation for the above response :

1) Created BO_child with an attribute called "fieldname" of type Plain text.
2) Created BO_parent with "data" as its attribute of type BO_child

Records are getting created with null values.

How do I fix this issue?
Last edited by bondicoffee on Wed Dec 11, 2019 6:57 pm, edited 1 time in total.
#52359 by swiftinitpvtltd
Wed Dec 11, 2019 11:47 am
Not sure why you are getting null because if its plain text it should dump json formatted data in plain text(may be length is small try 1000 in your column). Quickly looking at this if you want to get some data out of it in useful format there may be aware way to get it and if its too complex then you will have to parse the json using jquery or js I think.
#52362 by BobK
Wed Dec 11, 2019 5:18 pm
Your JSON is missing the last "}", or is that just a typo in your post.

What version of of AwareIM are you using?

I got this working (sort of) using build 2711.
I say sort of because only 1 BO_Child was created and the fieldname was populated with
value1^value2

I do not guarantee that I did not do something wrong myself, but I don't think that is what you want.

My guess is that AwareIM can not handle arrays in the format of
["value1","value2"]


I am no JSON expert, but I have only seen arrays like the following (which creates 2 BO_Child objects as expected)
{
"data": [
{
"fieldname": "value1"
},
{
"fieldname": "value2"
}
]
}
#52363 by bondicoffee
Wed Dec 11, 2019 7:02 pm
Thank you Bob for looking into the response sample closely and pointing to missed '}'.

With regard to your question on the AwareIm version, I am using v8.4 Build 2709. I will try updating Awareim and verify if this works. Thanks :)

Is there a way in Awareim to collect whole JSON data in one attribute? I plan to update this JSON response using string manipulations and then create BO.
#52365 by BobK
Wed Dec 11, 2019 7:45 pm
bondicoffee wrote:Is there a way in Awareim to collect whole JSON data in one attribute? I plan to update this JSON response using string manipulations and then create BO.


Yes.

On your intelligent BO, where you set the REST settings.
in the Reply section, check "Reply returned" and click on "Details..."
select "Write into object in Context" and select your desired BO from the Object drop down
and from the Attribute drop down, select the BO's attribute to write the data into.

Who is online

Users browsing this forum: Majestic-12 [Bot], MSN [Bot] and 14 guests