Quantcast
Channel: VFPX
Viewing all articles
Browse latest Browse all 3798

Commented Unassigned: nfjsonread breaks when an empty kv is passed [43497]

$
0
0
Hi,

when we pass an empty key-valye collection to nfjsoncreate I get an error. The input data is similar to this:

```
"nfjson_kv_collection" : {
"collectionitems" : [ ]
}
```

The error rises in function reviveCollection at line

```
For T = 1 To Alen(m.tv.collectionItems)

If m.keyValColl
esteval = m.tv.collectionItems(m.T).Value
```

Looks like collectionItems has a not-zero size even if it's empty
Comments: ** Comment from web user: amariottini **

With _kl_collection there is another problem: an empty json collection ({ "myEmptyCollection_kl_collection": { "collectionitems": [] }} ) is deserialized as a collection of 1 empty string element.

I changed nfjsonread this way:

```
n = Alen(m.tv.collectionItems)
IF n = 1 AND TYPE("m.tv.collectionItems[1]") == "C" AND EMPTY(m.tv.collectionItems[1])
n = 0
ENDIF
For T = 1 To n && it was Alen(m.tv.collectionItems)
......
```

This works but in case of a legitimate collection of 1 empty string this produce an empty collection...


Viewing all articles
Browse latest Browse all 3798

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>