last day (14 days later) » 

10:06 AM
0
A: Array to JSON Array in Swift

KarthickAs per you said you want to send value for key value as [(Int, Int)]. But actually you are sending as [[(Int, Int)]], which means array of array of tuples(Hope you need to send as array of tuples). Try to send list below, let parameters_post: Parameters = [ "sensor_id": "ecg_raw", "memb...

 
Hello, I change the structure. Can you please check the new one? I had two integer values and I decided to store them on different arrays. But still can't write it to database.
 
What error are you facing? What is the sample JSON?
 
Actually, I don't know exactly. As I searched, In JSON array should be like with "{" bracelet. But In my output, there is only square bracelet.
 
Okay. Could you please tell what error you are facing?
 
I'm not facing with anyproblem now. I mean I can store the values as I give the example but I'm not sure If it is an array or not and can I fetch it probably.
 
10:06 AM
I have debugged your api. Your response JSON is not valid one. Please make sure your JSON is valid and then try.
 
Hello
 
yes
 
Actually my json is correct but It should be like [data_array1]
 
You can validate your JSON using some online JSON validator.
 
It is valid I can put data to database. The one I wrote in my question is the valid data that I put from mobile. I only delete the square bracelets when post the question.
 
10:10 AM
The JSON you are uploading is valid.
Im talking about your response JSON.
Actually what is your issue. Please make it clear.
 
When I write paramater as;
let parameters_post: Parameters = [
"sensor_id": "ecg_raw",
"member_id": "58d3f509e48f4ca90dd218e4",
"esignal": "3.5V",
"ts": "emre",
"value1" : [data_array1],
"value2" : [data_array2]
]
It is working but put data in database
as
"value1": [
[
135,
91,
101,
115,
106
]
],
which is incorrect. I guess
I need to fix this problem,
 
Please set value for value1 = data_array1 not [data_array1]. Same for vaule2 key.
 
When I do that nothing happens on database.
 

last day (14 days later) »