Reputation: 11
Hi guys I am getting issue while reading this file can anyone suggest me how to read this file by using model name and tagline and also variant code of this model. I am new to reading in json using java , whenever I am trying to read getting this exception i.e. Exception in thread "main" java.lang.ClassCastException: class org.json.simple.JSONObject cannot be cast to class org.json.simple.JSONArray (org.json.simple.JSONObject and org.json.simple.JSONArray are in unnamed module of loader 'app') Any reference for this?
{
"models": {
"IN": [
{
"modelName": "Inter",
"modelTagline": "A classic roadster",
"models": [
{
"ID": "Inter-0",
"engineCapacity": "Test",
"imageUrl": "INT.png",
"mailCCBTR": "",
"mailToBTR": "",
"mailerBikeImageBTR": "orange.jpg",
"modelCodeBTR": "XYZ23",
"name": "Int 0",
"power": "47 Bhp",
"showCatalogue": true,
"showInDealer": false,
"showInREPrime": true,
"tagLine": "A classic roadster",
"torque": "52 Nm",
"variants": [
{
"highlights": [
"LOREM IPSUM",
"",
"",
""
],
"id": "int 50",
"imageUrl": "3F_GTred_000.png",
"name": "red",
"showBookNow": false,
"showConfigureNow": true,
"showInDealer": false,
"showInREPrime": true,
"tankColor": "Red",
"tankImage": "Red_01.png",
"variantCode": "AVC",
"webp": "000.webp",
"webp-mobile-1x": "3.webp",
"webp-mobile-2x": "2.webp"
},
{
"highlights": [
"LOREM IPSUM",
"",
"",
""
],
"id": "int 50",
"imageUrl": "V000.png",
"name": "Blue",
"showBookNow": false,
"showConfigureNow": true,
"showInDealer": false,
"showInREPrime": true,
"tankColor": "Blue",
"tankImage": "Blue_01.png",
"variantCode": "SADSAD32",
"webp": "F.webp",
"webp-mobile-1x": "LOREM IPSUM.webp",
"webp-mobile-2x": "LOREM IPSUM.webp"
},
{
"highlights": [
"LOREM IPSUM",
"",
"",
""
],
"id": "int 50",
"imageUrl": "80.png",
"name": "Crush",
"showBookNow": false,
"showConfigureNow": true,
"showInDealer": false,
"showInREPrime": true,
"tankColor": "Crush",
"tankImage": "h_01.png",
"variantCode": "56565SDGFS",
"webp": "h_000.webp",
"webp-mobile-1x": "LOREM IPSUM.webp",
"webp-mobile-2x": "LOREM IPSUM.webp"
},
{
"highlights": [
"It's a blast to ride on twisty back roads, highways or the urban jungle, with equal ease and grace, for novices and experienced riders alike",
"",
"",
""
],
"id": "inter50",
"imageUrl": "00.png",
"name": "Downtown Drag",
"showBookNow": false,
"showConfigureNow": true,
"showInDealer": false,
"showInREPrime": true,
"tankColor": "Downtown Drag",
"tankImage": "01.png",
"variantCode": "lkasdsd",
"webp": "int 500.webp",
"webp-mobile-1x": "int 500.webp",
"webp-mobile-2x": "test.webp"
},
{
"highlights": [
"It's a blast to ride on twisty back roads, highways or the urban jungle, with equal ease and grace, for novices and experienced riders alike",
"",
"",
""
],
"id": "int 50",
"imageUrl": "k_000.png",
"name": "Sunset Strip",
"showBookNow": false,
"showConfigureNow": true,
"showInDealer": false,
"showInREPrime": true,
"tankColor": "Sunset Strip",
"tankImage": "Black_01.png",
"variantCode": "AFDF23",
"webp": "TEST.webp",
"webp-mobile-1x": "TEST3.webp",
"webp-mobile-2x": "T.webp"
}
]
}
Hi guys I am getting issue while reading this file can anyone suggest me how to read this file by using model name and tagline and also variant code of this model. I am new to reading in json using java , whenever I am trying to read getting this exception i.e. Exception in thread "main" java.lang.ClassCastException: class org.json.simple.JSONObject cannot be cast to class org.json.simple.JSONArray (org.json.simple.JSONObject and org.json.simple.JSONArray are in unnamed module of loader 'app')
Upvotes: 1
Views: 108
Reputation:
looks like this json is not completed. If i have misunderstand, you can upload .json file. If this json is all, please append "]}]}}" to end of json. Good luck.
Upvotes: 0