JSON Data is Not Valid - json

I am getting "JSON Data is Not Valid" error on this Json and i couldn't find what is wrong with it.When I put it in something like a JSON Validator it says
Error: Parse error on line 66: ... "InfoStr": "[{" BankEftCode
":" 00
----------------------^ Expecting 'EOF', '}', ':', ',', ']', got 'undefined'
PS: I put 1234s and aaaa's on names and numbers for privacy so don't worry about them.
{"Header":{
"CallerId":"0060030000",
"RequestId":"10213",
"Status":"SUCCESS",
"ErrorCode":null,
"ErrorMessage":null
},"Body":{
"ComplaintSource":"aaa",
"BankEftCodeIssuer":"12345",
"BankEftCodeAcquirer":"12345",
"EntryUserName":"aaa",
"BankComplaintNo":"aaa",
"ComplaintTimestamp":"1234",
"CustomerIdType":"aaa",
"CustomerIdValue":"1234",
"CustomerName":"aaa",
"CustomerLastName":"1234",
"CustomerCompanyTitle":"",
"IsVIP":false,
"CustomerSegment":"aaa aaa",
"CustomerMobilePhone":"1234",
"CustomerIBAN":"1234567890",
"CustomerAccountNo":"1234",
"CustomerEmail":"",
"ComplaintStatus":"",
"ComplaintStatusStep":"",
"ComplaintStatusDetail":"",
"ComplaintCategory":"C1",
"ComplaintMainTopic":"C1.1",
"ComplaintSubTopic":"C1.1.3",
"ComplaintDate":"2022-05-24T11:28:00+03:00",
"ComplaintExplanation":"aaa",
"ComplaintAmount":8670.0,
"ComplaintCurrency":"TRY",
"ReconciliationAmount":0.0,
"ReconciliationCurrency":"TRY",
"ComplaintCardNo":"1234",
"ComplaintMaskedCardNo":"1224",
"ComplaintEncryptedCardNumber":"aaaa",
"RelatedComplaintNo":"0.0",
"TransactionAmount":8670.0,
"TransactionCurrency":"TRY",
"TransactionTimestamp":"12345676",
"TerminalId":"PT6172",
"TerminalLocation":"aaa",
"TransactionDate":"2022-05-23T11:44:00+03:00",
"TransactionRRNNo":"",
"TransactionAuthorizationNo":"",
"TransactionSTANNo":"",
"TransactionTAMRefNo":"aaaaa",
"TransactionCardNo":"12345",
"TransactionMaskedCardNo":"123456789",
"TransactionCardBrand":"M",
"TransactionCardType":"D",
"TransactionHashCardNo":"wertyuıop",
"TransactionTCKN":"123456789",
"TransactionYKN":"",
"TransactionMobilePhoneNumber":"123456789",
"Comment":"",
"PaymentAgent":"",
"PaymentAgentNo":"",
"PaymentSubscriptionNo":"",
"InfoStr":"[{"BankEftCode":"1234567890","TaskId":"12345","RequestUser":"aaa aaa","ResponseUser":"aaa01","RequestTimestamp":"1234567890","ResponseTimestamp":"134567","RequestComment":"aaaa","ResponseComment":"aaa",
"InfoElements":[{"Key":"AtmCashDifferenceCurrency","Value":null,"Type":null},
{"Key":"AtmCashSurplus","Value":"0","Type":null}
]
}]",
"F_TicketProcessType":"",
"NF_TicketProcessType":"",
"AtmResolveCode":"",
"SLADueDatetime":"2022-05-27T09:49:35.966",
"BankSLADueDatetime":"2022-05-25T12:36:22",
"IsInfoRequested":false,
"IssuerSLASatisfied":true,
"AcquirerSLASatisfied":false,
"ComplaintHashCardNo":null,
"ComplaintCardBrand":null,
"ComplaintCardType":null}}
Thanks for helping.

you InfoStr value is a string, not object , so it is not valid , should be
"InfoStr": "[{\"BankEftCode\":\"1234567890\",\"TaskId\":\"12345\",\"RequestUser\":\"aaa aaa\",\"ResponseUser\":\"aaa01\",\"RequestTimestamp\":\"1234567890\",\"ResponseTimestamp\":\"134567\",\"RequestComment\":\"aaaa\",\"ResponseComment\":\"aaa\",\"InfoElements\":[{\"Key\":\"AtmCashDifferenceCurrency\",\"Value\":null,\"Type\":null},{\"Key\":\"AtmCashSurplus\",\"Value\":\"0\",\"Type\":null}]}]",

Related

I'm getting error "detail": "JSON parse error - Expecting ',' delimiter: line 4 column 19 (char 64)" while trying to run my code, anyone please?

Json data:
{
"title": "Iska",
"number_of_pages": 3000,
"publish_date": 22/12/23,
"quantity": 20
}
JSON parse error - Expecting ',' delimiter: line 4 column 19 (char 64)"
not parse this value 22/12/23 to any type
It's inside quotation marks to identify it as String.
Your publish date should probably be in quotes as the slashes are likely short circuiting your json.

Invalid JSON Expression

I am making use of non-static import
JsonPath jp = response.jsonPath();
System.out.println(jp.get("data?(#.id>14).employee_name").toString());
For a JSON as shown below:
{"status":"success","data":[{"id":"1","employee_name":"Tiger Nixon","employee_salary":"320800","employee_age":"61","profile_image":""},{"id":"2","employee_name":"Garrett Winters","employee_salary":"170750","employee_age":"63","profile_image":""}]}
When i am trying to run it , i am getting below error:
java.lang.IllegalArgumentException: Invalid JSON expression:
Script1.groovy: 1: expecting EOF, found '[' # line 1, column 31.
data[?(#.id>14)].employee_name
^
1 error
Can someone guide me why is this error being thrown ?
I doubt if that syntax is right, nonetheless, you should be using the below
Also note that the id is a string in your response so you will have to include it in quotes
js.get("data.find {it.id > '14'}.employee_name").toString();

Unable to parse a valid Json from Arabic text

This appears to be valid Json but Json parsers throw an exception on address text. Can we not have arabic values as Json values?
{
"deliveryTime":"12:34:00",
"deliveryDate":"07-09-2017",
"paymentType":1,
"deliveryMethod":1,
"address":{
"text":"\"7774 جبل الجزيره، طويق"\, "\الرياض \13791 3836، السعودية\"",
"geo":{
"latitude":24.580577,
"longitude":46.518820
},
"noteToDriver":"Near bank",
"country":"Saudi Arabia"
}
}
https://jsonlint.com/ throws an exception but I couldn't figure out the issue. It has double quotes properly escaped, the entire address value is quoted. I think the problem is due to the right to left nature of the language that resulted in the error.
Error: Parse error on line 7:
...4 جبل الجزيره، طويق"\, "\الرياض \13791
-----------------------^
Expecting 'EOF', '}', ':', ',', ']', got 'undefined'

Invalid JSON - Cannot see why

The following JSON string comes back as invalid in several formatter tests. I cannot figure out for the life of me what is wrong!
{
"draw": 122,
"recordsTotal": 1496,
"recordsFiltered": 1496,
"data": [["11315","1403","John Doe","Parking Pass","-","Hyundai Sonata - Grey ABC 123 ","09-01-2016 2:00 AM","09-01-2016 7:00 AM","-"]]
}
https://jsonformatter.org/ is saying:
Parse error on line 5: ...,"Parking Pass","-","Hyundai Sonata - Gr
-----------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
https://jsonformatter.curiousconcept.com/ says:
Error:Invalid characters found.[Code 18, Structure 28]
and highlights the line "Hyundai Sonata - Grey ABC 123 ",
What the heck am I missing? I dont see any invalid characters anywhere. If I paste it into Notepad++ its not showing anything but "CRLF" on the line breaks.
After checking, it turns out that the value, which was being returned from a database, had a tab in it. I created a function to strip out any non ASCII chars and its working fine now

Cant validate JSON when using different language. Error invalid characters found

First time im trying to create a JSON file,
Im trying to create a JSON file with different language other than English , but when i try to validate, it show Error Invalid characters found.
i tried this
{
"data": [
{
"id": "1",
"title": "Oru Velli Thaaram Vaana Veedhiyil",
"lyrics": "ഒരു വെള്ളിത്താരം വനവീഥിയിൽ തെളിയവേ
കുളിരീറൻ കാറ്റും കുഞ്ഞുതരാട്ട് മൂളവേ
ഇരുളിനലകൾ മൂടും ധരയിതിലൊരു ദീപം
കദനഭാരമെല്ലാം നീക്കിടുന്ന സ്നേഹം
പിറന്നു മണ്ണിലുഷസ്സിൻ ശോഭ പോലെ
(ഒരു വെള്ളിത്താരം…
മരുഭൂവിൽ അലയുമ്പോൾ ആ താരം മുൻപേ
മറയാതെ രാജക്കൾക്കതുമാർഗമായി
മരുഭൂവിൽ അലയുമ്പോൾ ആ താരം മുൻപേ
മറയാതെ രാജക്കൾക്കതുമാർഗമായി
പുൽക്കൂടും തേടിത്തേടി ബെത്ലഹേമിലവരണയുമ്പോൾ
ഗീതങ്ങൾ പാടിപ്പാടി വാനദൂതരും അണയുന്നൂ
തിരുസുതനെ കാണുംനേരം പാടുന്നു ഗ്ലോറിയ …
(ഒരു വെള്ളിത്താരം…
ശാരോനിൻ താഴ്വാരം തഴുകുന്ന കാറ്റെ
വരുമോ എൻ നാഥൻറെ അരികിൽ നീ മെല്ലെ
ശാരോനിൻ താഴ്വാരം തഴുകുന്ന കാറ്റെ
വരുമോ എൻ നാഥൻറെ അരികിൽ നീ മെല്ലെ
തഴുകൂ നിൻ വിരലാൽ നെറുകിൽ സ്നേഹനാഥനെ ആലോലം
പാടൂ നൽ ശ്രുതിയാൽ കാതിൽ സാന്ദ്രമാനന്ദ സംഗീതം
ഈ രാവിൽ പാരാകെ പാടുന്നു ഗ്ലോറിയ
(ഒരു വെള്ളിത്താരം…",
},
{
"id": "2",
"title": "Pukootil Vannu Jaathanayi",
"lyrics": "പുൽക്കൂട്ടിൽ വന്നു ജാതനായി
നക്ഷത്രം ഇന്ന് മിന്നി നിന്നു
ക്രിസ്മസ് രാവിൻറെ ഗാനമായി
വിണ്ണിൽ ആനന്ദമേളമായി താരകം ദീപമായ്
കൺകളിൽ തിളങ്ങി നിന്നു (2 )
ദൂതരാ വീണകൾ മീട്ടിടുന്നിതാ
ലോകരാ കീർത്തനം കേട്ടിടുന്നിതാ
ദേവദാരു പൂത്തു പാതിരാവു പെയ്തു
മഞ്ഞുതുള്ളി വീണവീഥി മിന്നിടുന്നു
( പുൽക്കൂട്ടിൽ)
വിദ്വരോ കാഴ്ചകൾ നല്കിടുന്നിതാ
വിന്നതിൽ നോക്കി സംപ്രീതരായിതാ
കീറ്റുശീല തന്നിൽ ദിവ്യശോഭ കണ്ടു
ആട്ടിടയരെത്തി ആർത്തു പാടിടുന്നു
( പുൽക്കൂട്ടിൽ)",
}
]
}
Error shows as INVALID JSON , Invalid characters found.
please help me to resolve this problem .
Problem Coming from
"lyrics": "ഒരു വെള്ളിത്താരം വനവീഥിയിൽ തെളിയവേ
Error Type
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
Reason
Line breaks inside your string . Encode with \n .A string is a sequence of zero or more Unicode characters .