Jump to content
Sign in to follow this  
RussellW

How to test if TJSONVALUE is an array

Recommended Posts

I don't normally use the in build Delphi JSON, so how would you best test to see if TJSONVALUE  is a TJSONARRAY or TJSONOBJECT?

Share this post


Link to post
Guest
procedure foo(const value: TJSONValue )
begin
  if value is TJSONArray then
    begin
      // Yes, it is an array
    end
  else if value is TJSONObject then
    begin
      // Yes, it is an object
    end
  else
    begin
      // not array, not object
    end;
end;

 

Edited by Guest

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
Sign in to follow this  

×