I have an output bundle where a portion of the output looks like this:
[
"data": {
"custom_data": [
{
"answer": [
"example 1"
],
"custom_data_id": 554,
},
{
"answer": [
"example 1",
"example 2"
],
"custom_data_id": 555,
}
]
},
"fileSize": 35170
}
]
If custom_data_id = 555, I would like to map the string values to ids, e,g:
{
"example 1": 1234567,
"example 2": 7890123,
"example n": 6576878
}
Ideally, I then recreate the original object with the updated values so that the output becomes:
[
"data": {
"custom_data": [
{
"answer": [
"example 1"
],
"custom_data_id": 554,
},
{
"answer": [
"1234567",
"7890123"
],
"custom_data_id": 555,
}
]
},
"fileSize": 35170
}
]
What is a good pattern (or any pattern really) to use when the number of possible strings is relatively high (e.g. 50+)?