Display JSON contents as text?

I’ve seen countless examples so far where the contents of a JSON file are displayed with println. But how would one run those contents through a simple text() in processing?

Because I’ve been trying to get the array below within a text so I could display it next to a planet, though so far it only gives me:

> A JSONObject text must begin with '{'

    "id_code": "15LD2345",
    "Gravity": "5.2g",
    "name": "Georgiamayne-2LD"
    "id_code": "291XS931",
    "Gravity": "10.2g",
    "name": "XS-Alpha"
    "id_code": "99287OE2",
    "Gravity": "0.2g",
    "name": "Bicronla-99"
1 Like


1 Like


Learning JSON was on my to do list and I got this working.
Take a close look at your brackets and compare to example.


1 Like

Thanks for the links! Didn’t get it to work with the text() function unfortunately, but I’ll have another look at it later on.

Here is an example of displaying text to get you started:

1 Like