Learning JSON: my first question

I'm trying to get familiar with JSON.

Is JSON a "data representation" that only exists in RAM or is it also used for storage on and retrieval from disk?

E.g. if I have this simple JSON structure, how can I change the Client if I decide to save the structure to ~/Documents/valid_name?

Is there a convention for "valid_name"?

How to save the data?

How to read from disk?

Many thanks.

Image-000926

JSON is a string format (which Keyboard Maestro's JSON tokens and functions can parse to – and write out from – a JS object).

i.e. you write the string to file, typically using the extension .json
and read that file as a string too.


Learning JSON II.kmmacros (3.7 KB)

3 Likes

This is a highly educative example which should be on the wiki.

1 Like

I agree. Only after reading this explanation I understood what JSON was about. I often have to read several different explanations to understand abstract concepts.

Crucial in this explanation was the mentioning of the parsing feature. Before, I created my own approach, using regex, variables (client=mueller), file read and file write. The storage file was very readable and compact, but JSON wins wrt data handling.

current_client_name=mayer
number_words=1234
due_date=2025-09-03
language_combination=de-DE_nl-NL
1 Like