I'm trying to send some data through POST request to my server. I'm using JSONObject to send the data. This is the structure of my JSONObject
{
"P_ID": "1000000",
"P_Details": [
{
"Day": "14Mar19",
"DayMS": "1552510800000",
"items": [
{
"productID": "1000003"
},
{
"productID": "1000004"
},
{
"productID": "1000005"
}
]
},
{
"Day": "15Mar19",
"DayMS": "1558510800000",
"items": [
{
"productID": "1000003"
},
{
"productID": "1000004"
},
{
"productID": "1000005"
}
]
}
]
}
Now, this is a sample data for two days only.
In the end, I'll have data for 24 to 30 days and it'll be a huge JSONObject.
I've logged the complete JSONObject in my application before sending it to the server and I noticed that after 10 12 days data, the JSONObject.toString() isn't printing the complete values and the object is broken, it will be something like this.
{"P_ID":"1000000","P_Details":[{"Day":"14Mar19","DayMS":"1552510800000","items":[{"pr_ID":"1000000"},{"pr_ID":"1000001"},{"pr_ID":"1000002"},{"pr_ID":"1000003"},{"pr_ID":"1000004"},{"pr_ID":"1000005"}]},{"Day":"14Mar19","DayMS":"155251080
i've checked the character count and when it reaches 4051 lenght, it stops printing.
Now FIRST whats the issue here? Is there some characters Lenght limit for JSONObject or JSONArray because I've read these Q&A for String Length and my JSONObject.toString is nowhere near this limit.
Secondly, Should I actually create a JSONObject this big and send it through the mobile application?
PS. I've been trying to shrink this JSON Object but this is the bare minimum and maybe I'll have to add some more details along with productID
field.