Learn Courses My Dashboard

How to update JSON file programmatically?

Hi all,

I have this very simple JSON file, but how can I programmatically update it?

When I added the Content Blocker Extenstion the “ConentBlocker” folder was created, which contains the JSON file
I currently have no code, but I want to be able to update the JSON file with a url that is typed in a textfield in my app (not created yet)

This is the JSON file

[
    {
        "action": {
            "type": "block"
        },
        "trigger": {
            "url-filter": "reddit.com"
            
        }
    }
]

image

read up on how to read and write on files programmatically
you might need to work on how you format the writing though as it will not automatically make it a JSON

Thanks for the reply, i will try to check it out