Page 1 of 1

Json error

Posted: 23 Feb 2023, 19:42
by FVI
Hi, I got a problem with my plugin (vineyard code to use.json:3344):

Code: Select all

In vineyard pack.zip:

io.blueflower.stapel2d.util.json.JSONException: Value [[{"id":"$Vineyard1","type":"ground","title":"Vineyard decal 1","text":"A Vineyard decal for your countrysides. ","frames":[{"bmp":"Vigna1.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard2","type":"ground","title":"Vineyard decal 2","text":"A Vineyard decal for your countrysides. ","frames":[{"bmp":"Vigna2.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard3","type":"ground","title":"Vineyard decal 3","text":"A Vineyard decal for your countrysides. ","frames":[{"bmp":"Vigna3.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard4","type":"ground","title":"Vineyard decal 4","text":"A Vineyard decal for your countrysides. ","frames":[{"bmp":"Vigna4.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard1b","type":"ground","title":"Vineyard decal 1 left","text":"A Vineyard decal for your countryside. This version is oriented to the left. ","frames":[{"bmp":"Vigna10.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard2b","type":"ground","title":"Vineyard decal 2 left","text":"A Vineyard decal for your countryside. This version is oriented to the left. ","frames":[{"bmp":"Vigna20.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard3b","type":"ground","title":"Vineyard decal 3 left","text":"A Vineyard decal for your countryside. This version is oriented to the left. ","frames":[{"bmp":"Vigna30.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard4b","type":"ground","title":"Vineyard decal 4 left","text":"A Vineyard decal for your countryside. This version is oriented to the left. ","frames":[{"bmp":"Vigna40.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}]] at 0 of type io.blueflower.stapel2d.util.json.JSONArray cannot be converted to JSONObject 


What are json array and json object!? And what error is this please?
Thank you.

Re: Json error

Posted: 23 Feb 2023, 21:47
by kykywaHckuu
Can you send a screenshot of it?

Re: Json error

Posted: 23 Feb 2023, 22:03
by Kulche
A very quick look indicates that you might have a spare pair of square brackets at the very beginning and end of your json. A full, readable code would be helpful though.

Re: Json error

Posted: 23 Feb 2023, 23:08
by FVI

Code: Select all

In vineyard pack.zip:

io.blueflower.stapel2d.util.json.JSONException: Value 
[
[{"id":"$Vineyard1",
"type":"ground",
"title":"Vineyard decal 1",
"text":"A Vineyard decal for your countrysides. ",
"frames":[{"bmp":"Vigna1.png","w":32,"count":1}],
"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],
[{"id":"$Vineyard2",
"type":"ground",
"title":"Vineyard decal 2",
"text":"A Vineyard decal for your countrysides. ",
"frames":[{"bmp":"Vigna2.png","w":32,"count":1}],
"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],
[{"id":"$Vineyard3",
"type":"ground",
"title":"Vineyard decal 3",
"text":"A Vineyard decal for your countrysides. ",
"frames":[{"bmp":"Vigna3.png","w":32,"count":1}],
"border frames":[{"bmp":"border_frames.png",
"w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],
[{"id":"$Vineyard4",
"type":"ground",
"title":"Vineyard decal 4",
"text":"A Vineyard decal for your countrysides. ",
"frames":[{"bmp":"Vigna4.png","w":32,"count":1}],
"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],
[{"id":"$Vineyard1b",
"type":"ground",
"title":"Vineyard decal 1 left",
"text":"A Vineyard decal for your countryside. This version is oriented to the left. ",
"frames":[{"bmp":"Vigna10.png","w":32,"count":1}],
"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],
[{"id":"$Vineyard2b",
"type":"ground",
"title":"Vineyard decal 2 left",
"text":"A Vineyard decal for your countryside. This version is oriented to the left. ",
"frames":[{"bmp":"Vigna20.png","w":32,"count":1}],
"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],
[{"id":"$Vineyard3b",
"type":"ground",
"title":"Vineyard decal 3 left",
"text":"A Vineyard decal for your countryside. This version is oriented to the left. ",
"frames":[{"bmp":"Vigna30.png","w":32,"count":1}],
"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],
[{"id":"$Vineyard4b",
"type":"ground",
"title":"Vineyard decal 4 left",
"text":"A Vineyard decal for your countryside. This version is oriented to the left. ","frames":[{"bmp":"Vigna40.png","w":32,"count":1}],
"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}
]
]

 at 0 of type io.blueflower.stapel2d.util.json.JSONArray cannot be converted to JSONObject 
I tried to make it more readable in case there was another problem besides the parenthesis.

Re: Json error

Posted: 24 Feb 2023, 15:39
by Kulche
You did not remove the spare brackets.

Re: Json error

Posted: 24 Feb 2023, 19:47
by FVI

Code: Select all

In vineyard code56776.zip:

.blueflower.stapel2d.util.json.JSONException: Value
 [{"id":"$Vineyard1",
 "type":"ground",
 "title":"Vineyard decal 1",
 "frames":[{"bmp":"Vigna1.png","w":32,"count":1}],
 "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
 "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
 "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
 }] 
 at 0 of type io.blueflower.stapel2d.util.json.JSONArray cannot be converted to JSONObject
Why isn't it working? I removed the spare brackets...

Re: Json error

Posted: 24 Feb 2023, 20:10
by Kulche
As I said, please provide the full json file.

Re: Json error

Posted: 24 Feb 2023, 21:22
by NotPFA

Code: Select all

[
  {
    "id":"$Vineyard1",
    "type":"ground",
    "title":"Vineyard decal 1",
    "text":"A Vineyard decal for your countrysides. ",
    "frames":[{"bmp":"Vigna1.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  },
  {
    "id":"$Vineyard2",
    "type":"ground",
    "title":"Vineyard decal 2",
    "text":"A Vineyard decal for your countrysides. ",
    "frames":[{"bmp":"Vigna2.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  },
  {
    "id":"$Vineyard3",
    "type":"ground",
    "title":"Vineyard decal 3",
    "text":"A Vineyard decal for your countrysides. ",
    "frames":[{"bmp":"Vigna3.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
    
  },
  {
    "id":"$Vineyard4",
    "type":"ground",
    "title":"Vineyard decal 4",
    "text":"A Vineyard decal for your countrysides. ",
    "frames":[{"bmp":"Vigna4.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  },
  {
    "id":"$Vineyard1b",
    "type":"ground",
    "title":"Vineyard decal 1 left",
    "text":"A Vineyard decal for your countryside. This version is oriented to the left. ",
    "frames":[{"bmp":"Vigna10.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  },
  {
    "id":"$Vineyard2b",
    "type":"ground",
    "title":"Vineyard decal 2 left",
    "text":"A Vineyard decal for your countryside. This version is oriented to the left. ",
    "frames":[{"bmp":"Vigna20.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  },
  {
    "id":"$Vineyard3b",
    "type":"ground",
    "title":"Vineyard decal 3 left",
    "text":"A Vineyard decal for your countryside. This version is oriented to the left. ",
    "frames":[{"bmp":"Vigna30.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  },
  {
    "id":"$Vineyard4b",
    "type":"ground",
    "title":"Vineyard decal 4 left",
    "text":"A Vineyard decal for your countryside. This version is oriented to the left. ",
    "frames":[{"bmp":"Vigna40.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  }
]

Re: Json error

Posted: 24 Feb 2023, 23:08
by FVI
NotPFA wrote:
24 Feb 2023, 21:22

Code: Select all

[
  {
    "id":"$Vineyard1",
    "type":"ground",
    "title":"Vineyard decal 1",
    "text":"A Vineyard decal for your countrysides. ",
    "frames":[{"bmp":"Vigna1.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  },
  {
    "id":"$Vineyard2",
    "type":"ground",
    "title":"Vineyard decal 2",
    "text":"A Vineyard decal for your countrysides. ",
    "frames":[{"bmp":"Vigna2.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  },
  {
    "id":"$Vineyard3",
    "type":"ground",
    "title":"Vineyard decal 3",
    "text":"A Vineyard decal for your countrysides. ",
    "frames":[{"bmp":"Vigna3.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
    
  },
  {
    "id":"$Vineyard4",
    "type":"ground",
    "title":"Vineyard decal 4",
    "text":"A Vineyard decal for your countrysides. ",
    "frames":[{"bmp":"Vigna4.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  },
  {
    "id":"$Vineyard1b",
    "type":"ground",
    "title":"Vineyard decal 1 left",
    "text":"A Vineyard decal for your countryside. This version is oriented to the left. ",
    "frames":[{"bmp":"Vigna10.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  },
  {
    "id":"$Vineyard2b",
    "type":"ground",
    "title":"Vineyard decal 2 left",
    "text":"A Vineyard decal for your countryside. This version is oriented to the left. ",
    "frames":[{"bmp":"Vigna20.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  },
  {
    "id":"$Vineyard3b",
    "type":"ground",
    "title":"Vineyard decal 3 left",
    "text":"A Vineyard decal for your countryside. This version is oriented to the left. ",
    "frames":[{"bmp":"Vigna30.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  },
  {
    "id":"$Vineyard4b",
    "type":"ground",
    "title":"Vineyard decal 4 left",
    "text":"A Vineyard decal for your countryside. This version is oriented to the left. ",
    "frames":[{"bmp":"Vigna40.png","w":32,"count":1}],
    "border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],
    "edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],
    "edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]
  }
]
That code works perfectly! Thank you!

New problem :(

Posted: 25 Feb 2023, 10:39
by FVI
The code worked perfectly but now when I try to use my decals, I see annoying black holes...
Vigna3.png
Vigna3.png (939 Bytes) Viewed 5997 times
Screenshot_20230225-083230.jpg
Please don't use the texture


Why is it happening?

Re: Json error

Posted: 25 Feb 2023, 11:55
by Kulche
Because ground is flat, and your textures are not, Provide a separate slope texture file.

Re: Json error

Posted: 25 Feb 2023, 12:17
by FVI
I tried but the result was an even worse looking decal... Can it be fixed by changing the handle?

Re: Json error

Posted: 11 Mar 2024, 11:39
by DestinedGamer2
FVI wrote:
23 Feb 2023, 19:42
Hi, I got a problem with my plugin (vineyard code to use.json:3344):

Code: Select all

In vineyard pack.zip:

io.blueflower.stapel2d.util.json.JSONException: Value [[{"id":"$Vineyard1","type":"ground","title":"Vineyard decal 1","text":"A Vineyard decal for your countrysides. ","frames":[{"bmp":"Vigna1.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard2","type":"ground","title":"Vineyard decal 2","text":"A Vineyard decal for your countrysides. ","frames":[{"bmp":"Vigna2.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard3","type":"ground","title":"Vineyard decal 3","text":"A Vineyard decal for your countrysides. ","frames":[{"bmp":"Vigna3.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard4","type":"ground","title":"Vineyard decal 4","text":"A Vineyard decal for your countrysides. ","frames":[{"bmp":"Vigna4.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard1b","type":"ground","title":"Vineyard decal 1 left","text":"A Vineyard decal for your countryside. This version is oriented to the left. ","frames":[{"bmp":"Vigna10.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard2b","type":"ground","title":"Vineyard decal 2 left","text":"A Vineyard decal for your countryside. This version is oriented to the left. ","frames":[{"bmp":"Vigna20.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard3b","type":"ground","title":"Vineyard decal 3 left","text":"A Vineyard decal for your countryside. This version is oriented to the left. ","frames":[{"bmp":"Vigna30.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}],[{"id":"$Vineyard4b","type":"ground","title":"Vineyard decal 4 left","text":"A Vineyard decal for your countryside. This version is oriented to the left. ","frames":[{"bmp":"Vigna40.png","w":32,"count":1}],"border frames":[{"bmp":"border_frames.png","w":32,"handle y":8,"count":16}],"edge frames":[{"bmp":"edge_frames.png","w":16,"count":12}],"edge border frames":[{"bmp":"edge_border_frames.png","w":16,"count":32}]}]] at 0 of type io.blueflower.stapel2d.util.json.JSONArray cannot be converted to JSONObject 


What are json array and json object!? And what error is this please?
Thank you.
I might be late but since there are already solutions here, i will explain what an array is, you probably know what it means by now, and i dont know what a Json Object is,

so an Array is a group of items aka objects, its made using [], an example is

Code: Select all


Square Brackets represents an Array

    "frames": [{"bmp": "Example.png"}],

so a Json Array is an Array in Json (Probably)