Creating a dictionary in the function stack
Options
![Georges Duverger](https://us.v-cdn.net/6037124/user_avatars/1709796.jpg)
Georges Duverger
Trusted Xano Expert ✭
👋 Hello. First post here. I'm not totally sure if this belongs to the Transforming Data space or not so I'm posting it here just in case.
How would I go about creating a `{"foo": "bar"}` object in a function stack? I tried a few different things but I haven't been successful yet.
My long term plan is to have an endpoint return something like the following dictionary with static data (`foo` and `bar`) to test out things on the frontend.
{
"foo1": "bar1",
"foo2": ["bar21", "bar22", "bar23"],
"foo3": {
"foo31": "bar31",
"foo32": "bar32",
"foo33": "bar33"
},
"foo4": [
{"foo41": "bar41"},
{"foo42": "bar42"},
{"foo43": "bar43"}
],
"foo5": "bar5"
}Thank you. 🙏
How would I go about creating a `{"foo": "bar"}` object in a function stack? I tried a few different things but I haven't been successful yet.
My long term plan is to have an endpoint return something like the following dictionary with static data (`foo` and `bar`) to test out things on the frontend.
{
"foo1": "bar1",
"foo2": ["bar21", "bar22", "bar23"],
"foo3": {
"foo31": "bar31",
"foo32": "bar32",
"foo33": "bar33"
},
"foo4": [
{"foo41": "bar41"},
{"foo42": "bar42"},
{"foo43": "bar43"}
],
"foo5": "bar5"
}Thank you. 🙏
Comments
-
You can create a variable and use import JSON to create it. You should be able to paste this above into a variable. But let me know if you have any issues
-
It worked. Not only it imported the JSON but, because of how the UI is set up, it taught me how to do it manually if I ever wanted to. I love it! Thanks for the late-night support, Michael.
-
@Michael Udinski quick follow-up question for this one: is it possible to use actual variable names, like let's say
user.name
instead of"bar1"
. And then use json IMPORT, expecting it to directly map the variables to the actual objects?
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback