Object Notation
Options
Joe Thong
Member ✭
I'm trying to get the value for a property of an item in a Webflow CMS Collection.
This is the JSON
[CleanShot 2021-06-27 at 01.09.41@2x.png]
Ho would I access created-on?
I first did a foreach on myvar.response.result.items as item
then I tried to access it via:
1) item.created-on
2) item["created-on"]
and I still couldn't get it.
Tried looking at the documentation and couldn't find the answer.
Thanks!
Joe
This is the JSON
[CleanShot 2021-06-27 at 01.09.41@2x.png]
Ho would I access created-on?
I first did a foreach on myvar.response.result.items as item
then I tried to access it via:
1) item.created-on
2) item["created-on"]
and I still couldn't get it.
Tried looking at the documentation and couldn't find the answer.
Thanks!
Joe
Comments
-
Hey Joe - I'd use the SUBPATH feature to get as exact as possible, run the API, copy the results as JSON, create a new variable - hover over the variable name of the API call and click SUBPATH next to it. Then paste in the results and click define - this will allow you to click the exact field you want... item is in results so you at least need results.item.created-on - however, this is also an array so if you want a specific index you should specify that (i.e. results.item.0.created-on) however, I can't see your full response so my recommendation is the subpath method.
-
Hey Michael Thanks! I will look into subpath
-
There's a few videos of it in action (external APIs) but I'll make sure to include a tutorial specifically for it too soon
-
If I were to use the method above could I get all items in similar subpaths like "results.item.0.created-on, results.item.1.created-on, results.item.3.created-on" ETC? After creating the variable and selecting subpath, I'm only able to return the results from one entry. The API I'm using outputs its responses similar to those in this thread. So I only end up getting the first it the array with the above field. Basically only results.item.0.created-on and not results.item.0.created-on and not results.item.x.created-on like I want. I want to be able to apply the tutorial in your video below to an API like the one in this thread.
-
if you remove the index from your dot notation Xano will transform the data into a list of that path (Example: results.item.created-on)
-
Thank you for the quick reply. I really appreciate itThat did it. Now I'm I'm trying to find out the best way to get new data into hubspot from Xano.
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