<feed xmlns='http://www.w3.org/2005/Atom'>
<title>luci/applications/luci-app-example/htdocs/luci-static/resources/view/example/file-jsonmap.js, branch master</title>
<subtitle>Lua Configuration Interface (mirror)</subtitle>
<id>https://git.openwrt.org/project/luci/atom?h=master</id>
<link rel='self' href='https://git.openwrt.org/project/luci/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/luci/'/>
<updated>2026-10-07T17:38:49Z</updated>
<entry>
<title>luci-app-example: add a JSONMap example that saves to a file</title>
<updated>2026-10-07T17:38:49Z</updated>
<author>
<name>Victor Irzak</name>
</author>
<published>2026-10-02T21:38:32Z</published>
<link rel='alternate' type='text/html' href='https://git.openwrt.org/project/luci/commit/?id=d175293945618269d4e355a38d860efb2fbcb106'/>
<id>urn:sha1:d175293945618269d4e355a38d860efb2fbcb106</id>
<content type='text'>
The existing JSONMap examples are read-only and leave saving as an
exercise ("you would need to define custom handlers"). Add a view that
edits /etc/example.json with a JSONMap - a named section and an
add/remove list - and saves it: handleSave() calls map.save() with a
callback that reads the sections back from map.data, restores numbers
(the form stores strings) and writes the file with fs.write().

The UCI defaults script seeds the file, and the ACL grants read and
write on it in the file scope.

Signed-off-by: Victor Irzak &lt;victor@irzak.com&gt;
</content>
</entry>
</feed>
