# .json to tags error

**URL:** <https://forum.inductiveautomation.com/t/json-to-tags-error/110379>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [September 4, 2025, 2:45pm UTC](https://forum.inductiveautomation.com/t/json-to-tags-error/110379 "2025-09-04T14:45:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_MUSSO](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@Thomas\_MUSSO](https://forum.inductiveautomation.com/u/Thomas_MUSSO)\
**Post date:** [September 4, 2025, 2:45pm UTC](https://forum.inductiveautomation.com/t/json-to-tags-error/110379/1 "2025-09-04T14:45:31Z")

</div>

Hello everyone,

Here’s my problem. I want the content of a `.json` file to automatically feed a tag using a scheduled task.

Here is my `.json` file:

```python
{"timestamp": "2025-09-04T16:16:40+02:00", "topic": "data/moxa-tbedb1004623", "payload": "{"hostname":"moxa-tbedb1004623","ip":"10.228.68.197","lat":43.343553800,"lon":5.364255933,"signal":{"rssi":-68.00,"rsrq":-18.00,"rsrp":-100.00,"snr":13.40},"data":{}}"}

```

Here is my code in the project library (`read_json`):

```python
import json

def lireDerniereCoordonnees(file_path = "/var/lib/ignition/data/mqtt_data_json/data_moxa-tbedb1004623.json"):
    with open(file_path, "r") as f:
        lignes = f.readlines()
        print("Nombre de lignes lues :", len(lignes)) # debug
        if not lignes:
            return None, None
        derniere = lignes[-1].strip()
        print("Dernière ligne :", derniere) # debug
        obj = json.loads(derniere)
        payload = json.loads(obj["payload"])
        lat = payload.get("lat")
        lon = payload.get("lon")
        print("Lat/Lon :", lat, lon) # debug
        return lat, lon

```

Here is the content of my scheduled task:

```python
def onScheduledEvent():
    import read_json

    lat, lon = read_json.lireDerniereCoordonnees()

    if lat is not None and lon is not None:
        system.tag.writeBlocking(
            [
                "[default]MQTT_Tags/SMDB/Edge_Node_tbedb1004623/Centri/Metadata/Latitude_Edge",
                "[default]MQTT_Tags/SMDB/Edge_Node_tbedb1004623/Centri/Metadata/Longitude_Edge"
            ],
            [lat, lon]
        )

```

However, when I run a test via the Ignition terminal, here’s the result:

```python
Traceback (most recent call last):
  File "", line 3, in 
  File "module:read_json", line 0, in lireDerniereCoordonnees
IOError: [Errno 2] No such file or directory: '/var/lib/ignition/data/mqtt_data_json/data_moxa-tbedb1004623.json'

```

So I have a file access problem on my Linux PC.  
I already granted all rights to my `.json`.

Is it an issue somewhere in my script? Or an authorization problem?  
What should I do?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![JVDM](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@JVDM](https://forum.inductiveautomation.com/u/JVDM)\
**Post date:** [September 9, 2025, 11:55am UTC](https://forum.inductiveautomation.com/t/json-to-tags-error/110379/2 "2025-09-09T11:55:10Z")

</div>

Your error would imply to me that the file doesn’t exist. Try verifying whether it does by running this:

`import os `  
`file_path = "/var/lib/ignition/data/mqtt_data_json/data_moxa-tbedb1004623.json" print(os.path.exists(file_path))`

Please reply with the response.
