Jump to content
KBazX

TSslHttpRest.GetResponseJson and json array

Recommended Posts

The TSslHttpRest.GetResponseJson function cannot process json of the following type:

[]
["aaa"]
["aaa", "bbb"]

In theory, we should add an analysis of the presence of square brackets in the resulting string to this function.

Share this post


Link to post

The REST component does a simple check for {}, but would miss Json that comprises only array elements without any objects, which I assumed was very rare.  

 

But adding such a check is trival, meanwhile you can just parse ResponseRaw, albeit with the risk of failed parsing from non-Json text. 

 

Angus

 

  • Like 1

Share this post


Link to post

I just had this situation.

I requested an array of objects from the web service, but specified the incorrect range of the array index. The web service returned an empty array.

Share this post


Link to post

I always return REST Json responses with a results wrapper, success/fail, to avoid the client needing to parse for data. 

 

But your change is made, and will be in SVN this week.

 

Angus

 

  • Like 2

Share this post


Link to post

Unfortunately, I do not have the opportunity to influence the developers of the web service.

 

Thank you so much for your work!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×