Memento library <-> JSON (or JSONL or JASONDB)

120 views
Skip to first unread message

Bill Crews

unread,
Mar 19, 2026, 7:29:35 PMMar 19
to memento...@googlegroups.com
I know I've seen forum articles mentioning JSON, but I don't recall if there's a JavaScript Library available for it or any other way to get it done programmatically or via the user interface. 

Ideally, I could extract a library, or filtered portion of a library, or a family of linked libraries and be able to re-import after processing it using other tools. 

If anyone could send me links or pointers to such info, I'd very much appreciate it. 

David Gilmore

unread,
Mar 20, 2026, 10:20:00 AMMar 20
to mementodatabase
JSON is simply a text file formatted in a specific way. It is great for computers to use, but difficult for humans to work with them.

But as far as exporting or importing data, you can export and import a Memento library in ".csv" (Comma delimited text file) format. Excel can easily import and export CSV files.

When I converted from HanDBase to Memento, I exported the data in CSV format in HanDBase, opened it with Excel to make some necessary changes (the date formatting is different between the two apps, for example), and then imported the file into Memento.

Bill Crews

unread,
Mar 20, 2026, 12:04:55 PMMar 20
to David Gilmore, mementodatabase
Yes, but many tools are increasingly using JSON for structured data interchange, JSONL is easily piped between tools, and JSONDB is beginning to have viable apps available, maybe someday competing with Memento. 

JSON preserves data typing, among other things, in a superior manner to CSV, which seems to forever be useful mainly only for spreadsheets. JSON doesn't solve all my problems, like preservation of relationships, but I'm beginning to work with it pretty well. I'm currently converting most of my database and note-taking to Obsidian, and JSON would help in the structured-to-markdown/JSONDB transition. 

I worked with ChatGPT to design a command line shell language to use within ChatGPT that allows JSONL to be piped from app to app. Between that and Obsidian and conversion of data between typed and untyped using regular expressions and sed-like and even awk-like tools, I'm just beginning to have a productive data/work flow stream and work environment. 

I know I've seen JSON mentioned in the Memento forum, but my forum searches are not very effective, so I'm hoping that members will help me dredge up what knowledge there is about its use with Memento, which is where almost all my structured data is.

Thanks. 



--
You received this message because you are subscribed to the Google Groups "mementodatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mementodataba...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mementodatabase/3d95d9c6-efd9-4e70-8f9a-eb565a603b10n%40googlegroups.com.

Mmm

unread,
Mar 20, 2026, 6:44:25 PMMar 20
to mementodatabase
Вариант разбора шаблонов библиотек (*.mlt2). Больше интересовали скрипты в них.
пятница, 20 марта 2026 г. в 19:04:55 UTC+3, bill....@gmail.com:

David Gilmore

unread,
Mar 20, 2026, 7:06:29 PMMar 20
to mementodatabase
I was not faulting JSON, just saying that it is difficult to work with. Takes a lot of code to handle, unless the code is expecting the data to be in a certain order/format.  CSV files are a lot easier to work with dealing with databases (which, when it comes down to it, are just much more capabile spreadsheets).

A simple Google of "javascript json library" brings back information on the Javascript JSON inbuilt object.

Just for curiosity I entered the following script into Memento. The script worked (It displayed "John" as expected).

var text = '{ "employees" : [' +
'{ "firstName":"John" , "lastName":"Doe" },' +
'{ "firstName":"Anna" , "lastName":"Smith" },' +
'{ "firstName":"Peter" , "lastName":"Jones" } ]}';

const obj = JSON.parse(text);

message(obj.employees[0].firstName);

Bill Crews

unread,
Mar 20, 2026, 8:04:24 PMMar 20
to David Gilmore, mementodatabase
Yes, though there are various JSON parsers, the embedded JSON JavaScript object is suitable so long as none of the objects contain subobjects (https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON), so I'll probably use that, but the problem to be solved is to get the library structure into that JSON format of an array of objects, each consisting of an array of fields, each of which consists of a 2-element array of ["field name", "field value"]. Once I have that formatted string, I can take it from there, but though I was once able to parse a .template file, I have never attempted to parse a .mlt2 file. If I wanted to do it all myself from scratch, that's what I would set out to do, emitting JSON or JSONL output. I don't know how Embedded Object fields are represented in a .mlt2 file -- maybe just as JSON subobjects? 

Anyway, if all this has been done, I'd like to know how it was done. If that's not possible, I'll give it a try myself via the .mlt2 file and let forum members know how I did it or even the code I come up with to do it. No promises, though. I am always running into my limitations.


Bill Crews

unread,
Mar 20, 2026, 9:03:47 PMMar 20
to David Gilmore, mementodatabase
Woops! This is what I do nowadays. I slip up in the details of things. 

That array of fields and their values was stated wrong. When I incorrectly referred to "a 2-element array of ["field name", "field value"]", I should have said something consistent with what David showed below...

['{ "firstName":"John" , "lastName":"Doe" },' +
'{ "firstName":"Anna" , "lastName":"Smith" },' +
'{ "firstName":"Peter" , "lastName":"Jones" }']

Mmm

unread,
Mar 20, 2026, 11:41:45 PMMar 20
to mementodatabase
Если речь идёт только о записях в формате JSON, то в Memento все для этого есть.

Посмотрите:
entry().values() 

Такой же результат можно получить и с помощью:

sql().asObjects()

и последующим преобразованием полученного массива объектов в JSON с помощью:

JSON.stringify(objects) 

Также можно получить массив названий всех полей библиотеки с помощью:

lib().fields()

выбрать из списка нужные поля и с помощью конструктора объектов создать выборку только для нужных полей. 
Именно такой способ был использован при создании шаблона библиотеки с встроенными записями. 

В своей технической библиотеке я использую окно dialog() с ui().checkbox() для выбора нужных полей.

Поля встроенный объект будут выглядеть как массив объектов.
Пример:
[{"DEBIT ACCOUNT":[{"ACCOUNT NAME":"ACCOUNT 2","AMOUNT":null},{"ACCOUNT NAME":"ACCOUNT 3","AMOUNT":null},{"ACCOUNT NAME":"ACCOUNT 5","AMOUNT":null},{"ACCOUNT NAME":"ACCOUNT 1","AMOUNT":null}]}]

Поле "DEBIT ACCOUNT" содержит 4 элемента.

Возможно будут проблемы с полями контакт и координаты. Не проверял.

Для переноса результатов полей JS и расчетных полей может потребоваться предварительное копирование этих результатов в дополнительные поля строка или число.

Не решил вопрос переноса изображений на другое устройство, так как ссылки на них недоступны.

Поэтому вариант с выбором полей мне кажется наиболее подходящим и гибким. 

На скриншотах пример работы технической библиотеки. Концевые ограничители "@@@" добавлены для решения определенной задачи. 
К сожалению, выложить шаблон технической библиотеки не готов, требуется ее существенная доработка.

суббота, 21 марта 2026 г. в 04:03:47 UTC+3, bill....@gmail.com:
IC__21032026.jpg

Er Mo

unread,
Mar 21, 2026, 2:36:49 PMMar 21
to mementodatabase
Hallo Bill
Ich habe Daten mittels API abgefragt und diese in einer Bibliothek gespeichert . Das war einfach . Man muste nur die Namen kennen . Hir ein Auszug von den Skript:

Hi Bill

I retrieved data using an API and stored it in a library. It was easy. You just had to know the names. Here's an excerpt from the script:

var result = http().get(url);
  if(result.code == "200") {
     var products = JSON.parse(result.body);
    var apil = products.body.length
    for( var j =0;j<apil;j++){
     api1 = new Object();
     var product = products.body[j];
     var dat1 = product.inserted_at;
var lg = product.data.longitude;
     var bg = product.data.latitude;
     api1["Ort"] = bg + "," + lg
     api1["Down-Framecount"] = product.data.down_fcnt;
     api1["GPS-Satelliten"] = product.data.gps_satellites;
     api1["rssi"] = product.data.rssi;
     var rsi = product.data.rssi;
     api1["gw rssi"] = product.data.gw_rssi;
     var rsigw = product.data.gw_rssi;
     api1["snr"] = product.data.snr;

Ernst

Bill Crews

unread,
Mar 21, 2026, 5:50:28 PMMar 21
to Er Mo, mementodatabase
Thanks, Ernst! So, the URL was to a Memento library? 


Er Mo

unread,
Mar 22, 2026, 3:45:49 AMMar 22
to mementodatabase
Hallo Bill
Nein . Ich habe in dieser Bibliothek Daten von einer URL ( API ) abgefragt und diese Daten gespeichert . Vom Netz in die Bibliothek  Dabei habe ich als Antwort von Netz eine JSON Daten erhalten . Diese  habe ich auf die Felder aufgeteilt und eingetragen . Ich habe so auch die Abfrage von Wetterdaten gemacht ( Andere Bibliothek )

Hi Bill

No. I retrieved data from a URL (API) in this library and stored that data. From the network to the library, I received JSON data as a response. I split this data into fields and entered it. I also used this method to retrieve weather data (from another library).

Ernst

Bill Crews

unread,
Mar 22, 2026, 1:06:48 PMMar 22
to Er Mo, mementodatabase
Vielleicht wissen alle anderen, wie man das macht, aber ich ganz sicher nicht. Danke trotzdem.

Maybe everyone else knows how to do that, but I certainly don't. Thanks, anyway. 


Reply all
Reply to author
Forward
0 new messages