# Parsing and Reading Serial JSON data

**URL:** <https://discourse.processing.org/t/parsing-and-reading-serial-json-data/44806>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [July 24, 2024, 3:13am UTC](https://discourse.processing.org/t/parsing-and-reading-serial-json-data/44806 "2024-07-24T03:13:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfusco](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@mfusco](https://discourse.processing.org/u/mfusco)\
**Post date:** [July 24, 2024, 3:13am UTC](https://discourse.processing.org/t/parsing-and-reading-serial-json-data/44806/1 "2024-07-24T03:13:16Z")

</div>

Hi,

I’m trying to send serial JSON data from an Arduino to Processing. I found documentation on reading JSON data from a file, but I’d like to read the JSON data from a Serial input. I tried the following code:

```auto
val = myPort.readString(); 
  
  if (val != null) {
    data = loadJSONObject(val);
}

```

However, with the above code I get the error:

The file is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.

How can I parse Serial JSON data? Any help would be greatly appreciated.

---

<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:** [July 24, 2024, 3:36am UTC](https://discourse.processing.org/t/parsing-and-reading-serial-json-data/44806/3 "2024-07-24T03:36:10Z")

</div>

Hello @mfusco,

> [@mfusco](#):
>
> How can I parse Serial JSON data?

Take a look here:

> **[parseJSONObject() / Reference](https://processing.org/reference/parsejsonobject_)**
>
> Takes a String, parses its contents, and returns a JSONObject. If the String does not contain JSONObject data or cannot be parsed, a null value is returned.

`:)`
