# Display JSON contents as text?

**URL:** https://discourse.processing.org/t/display-json-contents-as-text/12139
**Category:** Coding Questions
**Tags:** homework
**Created:** [June 17, 2019, 10:14pm UTC](https://discourse.processing.org/t/display-json-contents-as-text/12139 "2019-06-17T22:14:02Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![RealDwayneJ](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/realdwaynej/32/4514_2.png) [@RealDwayneJ](https://discourse.processing.org/u/RealDwayneJ)
#### Post date: [June 17, 2019, 10:14pm UTC](https://discourse.processing.org/t/display-json-contents-as-text/12139/1 "2019-06-17T22:14:02Z")

</div>

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 '{'**

```auto
[
  {
    "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"
  }
]

```

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [June 17, 2019, 11:47pm UTC](https://discourse.processing.org/t/display-json-contents-as-text/12139/2 "2019-06-17T23:47:06Z")

</div>

> [@RealDwayneJ](#):
>
> I’ve been trying to get the array below…

> [@RealDwayneJ](#):
>
> A JSONObject text must begin with ‘{’.

> **[JSONArray / Reference](https://processing.org/reference/JSONArray.html)**
>
> A JSONArray stores an array of JSON objects. JSONArrays can be generated from scratch, dynamically, or using data from an existing file. JSON can also be output and saved to disk, as in …

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [June 18, 2019, 2:06am UTC](https://discourse.processing.org/t/display-json-contents-as-text/12139/3 "2019-06-18T02:06:38Z")

</div>

[https://processing.org/reference/JSONArray\_getJSONArray\_.html](https://processing.org/reference/JSONArray_getJSONArray_.html)  
[https://processing.org/reference/println\_.html](https://processing.org/reference/println_.html)  
[https://processing.org/reference/text\_.html](https://processing.org/reference/text_.html)

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

🙂

---

<div class="post-metadata">

### Author: ![RealDwayneJ](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/realdwaynej/32/4514_2.png) [@RealDwayneJ](https://discourse.processing.org/u/RealDwayneJ)
#### Post date: [June 18, 2019, 2:57pm UTC](https://discourse.processing.org/t/display-json-contents-as-text/12139/4 "2019-06-18T14:57:07Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [June 18, 2019, 3:42pm UTC](https://discourse.processing.org/t/display-json-contents-as-text/12139/5 "2019-06-18T15:42:25Z")

</div>

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

> [@Blurry Text Solution](https://discourse.processing.org/t/blurry-text-solution/11293):
>
> I was using different text sizes in a recent project and was getting blurry fonts. I solve this issue by setting the largest text size in setup() and problem solved! Here is the code I used to test this: /\* Project: Blurry Text Author: GLV Date: 2019-05-15 Version: 01 \*/ void settings() { size(1024, 768, P3D); } void setup() { textSize(128); // Set to largest text size used to prevent blurring of text } void draw() { background(0); text24(); t…
