How to find index in list(?)

How do I find the index of in this case “bones” in what I can’t tell is a list or not?

I had

And tried

Which didn’t work

You might find some useful solutions in this thread

Here's a way to do it

(the all but first of block is so it works with empty lists)

are you actually trying to get where "bones" is or do you want what's to the right of it?
this looks like there was an object/hashmap in the json, this gets converted to an association array (assoc), the snap manual has information on it and there's a library to easily use them.

on the right,

(objects/hashmaps in the json that gets converted into assoc)

Thanks, I’m too lazy but thanks :+1:

well in that case, load the list utilities library. In there, there's an asoc block, and do this.

To get the data, you need to get item 2 of the resulting list.

It worked, I’m just surprised that you knew exactly the result would be, I had to change the test to prove I didn’t just copy your image

Oh, I've used the asoc block so many times that I know how it works, and when to use it.

Thanks for this solution! I made it into a custom reporter because I know I’ll use this


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.