function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
punnoosepunnoose 

json parsing problem

 

when i try to parse the string

 

 

with this code

             counter=0;
                while (parser.nextToken() != null && counter<10)
                {
                counter++;
                    if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) && (parser.getText() == 'total_records'))
                     {
                     
                            // Get the value.
                                parser.nextToken();
                            // Compute the grand total price for all invoices.
                            Temp=parser.getText();
                            file_count=integer.valueof(Temp);
                            if(file_count==0)
                            {
                             file_exists=0;
                            
                             }
                           // csv_ids.add( Temp);
                      }
                }
                counter=0;
                 
my json string is

{"success":true,"total_records":1,"data":[{"file_name":"aaavalid.csv"}]}

 

 

 

 

Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,4]
An unexpected error has occurred. Your solution provider has been notified. (system)

How do i resolve this problem

Thanks in advance

punnoose

sfdcfoxsfdcfox

Your JSON is invalid at line 1, column 4. Check your JSON string.

punnoosepunnoose

i have checked my json in http://jsonlint.com/ it is saying json is valid

NagShaNagSha
Hi all.,
 

punnoose.,

 

Do you fix the error?

S S MalikS S Malik
I am facing the same issue