How to Reference JSON Value Where Path includes spaces
Options
![Stephen Smith](https://us.v-cdn.net/6037124/user_avatars/2826800.jpg)
Stephen Smith
Member ✭
I am working with some legacy data that include spaces in object names which comes through as the below...
"fields":{
"Bakery Name":"Tasty Bread",
"Job Reference":"4556",
"Bakery Type":"Bread"
}
How can I reference values say "Bakery Name" using dot notation?
I have tried
• fields.Bakery Name
• fields."Bakery Name"
• fields.["Bakery Name"]
• fields["Bakery Name"]
to no avail 😟
What is the correct syntax to reference a value where a name contains spaces?
Any help would be greatly appreciated.
"fields":{
"Bakery Name":"Tasty Bread",
"Job Reference":"4556",
"Bakery Type":"Bread"
}
How can I reference values say "Bakery Name" using dot notation?
I have tried
• fields.Bakery Name
• fields."Bakery Name"
• fields.["Bakery Name"]
• fields["Bakery Name"]
to no avail 😟
What is the correct syntax to reference a value where a name contains spaces?
Any help would be greatly appreciated.
Comments
-
just a guess - did you try Bakery_Name? That's how Xano does it at least - I think because it's running php?
The other thought might be to try extracting the data via the functions under the objects section of the data manipulation functions -
Hey Mitch, thanks for the reply.
I have tried using an underscore "Bakery_Name", no joy though.
When trying to use the object function "Get Values" it gives me the error "Please only use letters, numbers, and underscores."
Appreciate the ideas! -
what if you applied a filter on the path field - maybe use replace, and replace " " with "_"?
-
you should be able to use the GET filter instead of dot notation: https://docs.xano.com/working-with-data/dot-notation#get-filter
Additionally, I believe if you use SUBPATH by pasting in the copied JSON response, it should allow for the spaces.https://youtu.be/lYNwajsknKY
-
Thanks Mitch for the help!
Your suggestion worked, thanks
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