I am not proficient in C, so I don't know if this is something that can already be done another way. I am dealing with an api that returns objects named with strings like "stream945" and I am creating linked lists of streams as I iterate over them with ->next. However, they can be mixed with other children objects that are not relevant and have different naming.
Send that cJSON* object and "i" as the string. and it returns only the first level children of root named starting with i, which is just id. If it is within the purview and standards for cJSON, it would be a very nice inclusion, and if reasonable having something to search suffix or just general containing string would be just as useful.
I am not proficient in C, so I don't know if this is something that can already be done another way. I am dealing with an api that returns objects named with strings like "stream945" and I am creating linked lists of streams as I iterate over them with ->next. However, they can be mixed with other children objects that are not relevant and have different naming.
I wrote the below function and parsed the string:
Send that cJSON* object and "i" as the string. and it returns only the first level children of root named starting with i, which is just id. If it is within the purview and standards for cJSON, it would be a very nice inclusion, and if reasonable having something to search suffix or just general containing string would be just as useful.
Also, if this code is deemed acceptable, I would be willing to pull request it, I am just not confident in it.