Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

SRP_Extract_JSON ??

Suggestion: I wonder if there is any interest in a JSON equivalent of the SRP_Extract_XML() function, that can extract data from a JSON structure using a JSONpath expression - in much the same way that SRP_Extract_XML() uses Xpath to extract XML. (The JSONpath website includes C# code).

I've been working with a web service that offers both XML and JSON formats for its responses. I started off working with the JSON format, but switched to XML when I found that the complexity of my code was significantly reduced by using SRP_Extract_XML() with Xpath queries.

With JSON structures becoming more prominent in web services, I imagine a JSONpath parser would become very useful.

Cheers, M@

Comments

  • M@ - While perhaps not as rich as XPath, SRP_JSON does support a path syntax. I'm not sure if you knew this or perhaps you did but it doesn't support your needs. Look at the example code in the GETVALUE service.
  • Hi Don - gosh no, I didn't realize that! Probably because I've been working off simple examples rather than going back to the docs ;). I think this would go a long way in most situations.
    For my case, I need to do something like GETVALUE 'menu.items.id' (to use the example on the wiki) to get a flat array of all the 'id' items.

    Thanks, M@
Sign In or Register to comment.