JSON element_texts not using same index for same data fields

We have added custom item types to enter additional fields in our collections.

We are pulling the data with JSON.

The custom fields appear in JSON as element_texts[x].text

The problem is the in the same collection, in one item element_texts[3].text might be the Spouse field and in another item in the collection element_texts[3].text is the Bio field.

Is there a way we can map the element_texts[x] fields so that we know what field is a given value? In other words, so that element_texts[3].text is the Spouse field for all items in the collection. We can write PHP.

Each entry in the element_texts array has an element property that describes the element, and an element_set property that describes the set. You can look at the IDs or names for the element and set in those sub-objects to determine what field each piece of text goes with.

Having them all be the same index in the array for the same field isn’t really how the system is set up to work: for one thing, each field can have multiple values or be missing entirely on any item, which is going to mess up any attempt to line up those indexes.

I see the element name, but that is a real pain to have to parse it to figure out which element it is.

Thanks for your quick response.