#1 2025-05-07 00:16:40

eternalnewbie
Member
Registered: 2025-05-06
Posts: 1

Variable types of every JSON pair (name and value)?

I have downloaded JsonViewerSource.zip and, naturally, read the (translated) post here.

https://www.delphipraxis.net/212923-mor … ieren.html

I am trying to use it for my purposes [write something similar to MQTT Explorer].

But I need some help.

How do I get the variable type of elements other than dvObject or dvArray?

The following (as well as various permutationsa I tried) does not seem to work:

PDocVariantData(GetNodeData(ANode)).DocVData.Names[ANode.Index].Kind

In other words, I want to get the 'kind' of either element of any pair?

How can I do that?

Could you help, please.

Offline

#2 2025-05-07 06:55:58

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,005
Website

Re: Variable types of every JSON pair (name and value)?

A name is always a RawUtf8.

A value is stored as a variant, so you can check if it is an object or an array using _Safe(DocVData.Values[ANode.Index])^.Kind.

Offline

Board footer

Powered by FluxBB