JSON not parsing multiple strings in array?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By blueSuedeShoes

I have the following JSON

[{
"id": 1,
"npc": "man",
"dialogue": ["Oh, hello I didn’t see you there”, “Perhaps we can talk later?"]
}]

And parsing it through as so

var file = File.new()
file.open("res://data/dialogue/man_dialogue_eng.json", file.READ)
var raw_text = file.get_as_text()
var json = JSON.parse(raw_text)
file.close()
dialogue_raw = json.result[0]["dialogue"]
print(dialogue_raw)
dialogue = dialogue_raw[page]

When in game, it seems to return not as an array with two entries - just one long, combined string:

Oh, hello I didn’t see you there”, “Perhaps we can talk later?

Why might this be?

:bust_in_silhouette: Reply From: guppy42

Not sure if it’s a typo, but if it’s not then that’s the reason;

"Oh, hello I didn’t see you there”, “Perhaps we can talk later?"

see how there are 2 kinds of quotes? the regular one " and the “prettyfied” one the second one is not a real quote.

That did it, thanks!

It hadn’t even occurred to me - I ought to be more careful with what I’m using to edit next time.

blueSuedeShoes | 2018-11-28 14:52