fastn
get-data
processor is used to get data from a JSON files in the package.-- import: fastn/processors as pr -- string foo: $processor$: pr.get-data file: foo.json
foo
from foo.json
and store it in the variable named foo
.key
attribute:-- import: fastn/processors as pr -- string foo: $processor$: pr.get-data key: some-other-key-instead-of-foo file: foo.json
-- import: fastn/processors as pr -- string foo: $processor$: pr.get-data "hello world"
get-data
processor.integer
, boolean
, string
etc, the default value can also be provided in the caption. E.g.-- import: fastn/processors as pr -- string foo: hello world $processor$: pr.get-data
body
and caption
when using get-data
is an error.index.ftd
index.ftd
and another file should be foo.json
index.ftd
-- import: fastn/processors as pr -- record person: caption name: integer age: string gender: -- person arpita: $processor$: pr.get-data file: foo.json -- ftd.text: $foo.name -- ftd.text: $foo.age -- ftd.text: $foo.gender
file
must point to a valid json
file with extension .json
.foo.json
{ "name": "arpita", "age": 15, "gender": "female" }
fastn serve
and view 127.0.0.1:8000
(use whatever port reported by fastn serve
), and you should see something like this:arpita 15 female
Have a question or need help?
Visit our GitHub Q&A discussion to get answers and subscribe to it to stay tuned.
Join our Discord channel and share your thoughts, suggestion, question etc.
Connect with our community!We welcome you to join our Discord community today.
We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.