I’m using Android, and I have a strange question: how can I parse JSON data that has the following format:
"2"
The JSON URL result is this number only, without any brackets ({ } or [ ]). How this array is formed? Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First retrieve the remote URL and decide if it is JSON or text/plain
Read out the response body.
Based on the content type header you can decide if it is JSON or a plain/text contents. Alternatively, peek at the first character to see if it is an opening curly brace.