I have a large string. In the string, there is a number. I am trying to use C# to return just that number
Sample string:
{ "@odata.context": "https://api.applicationinsights.io/v1/apps/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/events/$metadata#customEvents", "@ai.messages": [ { "code": "AddedLimitToQuery",
"message": "The query was limited to 500 rows" } ], "@odata.count": 45, "value": [ { "id": "XXXXXXXXXXXXXXX",
"count": 1..."
My goal is just to return 45 as an int.
The first number after "@odata.count":
I know I can parse the whole string with some JSON to object tool e.g. newtonsoft. However, in this case, I need this to be very performant and don't want to parse data I don't need.
On this case, I know the data I need is in the first 2 or 3 lines of a 100,000+ JSON.
My goal is not to parse the whole object by just to get a single value as fast as possible.
Question
How can I get the first number following a specific text string?