Page 2 of 2 FirstFirst 12
Results 41 to 42 of 42

Thread: [RESOLVED] JSON-Decoding of RC5/RC6

  1. #41
    Frenzied Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,289

    Re: [RESOLVED] JSON-Decoding of RC5/RC6

    Curpath exist, see this private variable using search, to found where. You can get the current path, you can set the current parh, see restorepath.
    The idea about curpath, is that they are two faces. One is the expanded path, say 1.alfa.34.beta.delta
    This is how we use to build a path. Inside flatjson this path has @@ and following a long as 2 wchar characters (fake characters) for each key part. So 5 parts means 5*2+2 (for root), 12 characters for the key. That key produce a hash code A, which turn to a Hash code B, 4 bytes long. Hash code A saved with key, to be used at rehash happen.
    When we use FirstItem/NextItem/done if we have an object, no hash used, because its sibling object is in a linked list, one way. So to go back we have to run a walk from first to last and get the actual index (property index), which is valid if done is true and if we didn't remove some item. Removing an item move the top item to removing item unless it is the top item. Because items in an object are linked using index as pointer, we maintain the objects order. jsonObject didn't have
    a linked list, so after removing an item, except laet one (topitem), we lost the order.
    For items which are parts of an array, there is not linked list. So the NextItem add one to last long which is at the position of last two characters of curPath (private to class). Because null are not saved to structure, we can get a curpath at nextitem which didn't exist, and by definition any path, which didn't exist return null value. The size of array kept at the array item. So say we have a structure which is an json array. The @@ root object is an array (fake), which return itemsCount, 0 or more, but we may have null for all positions, which means that there are no items in structure for this full null items array. Also the actual order of array items are irrelevant from the indexing order, because we always get array items by key. In jsonArray we can insert values, say between 5 and 6, so 6 change to 7, but here in flatjson, we can't. Its easy to add this functionality.
    So when I found time (I am a grandfather, and some days I do babysitting on my grandchilds), I look how I can make flatjson to read a structure in pieces, using a ParseInit, and subsequent Parse callings. Also reading may apply when a path exist, before actuall some structures are not finish yet the reading of all items. That can be done bevause we have keys for each item with path. All other formats, need to extract pointer until the last collection/ cCollection/JsonBag/JsonObject or JsonArray. So for these structures a 5 key path means some work to get 4 inner pointers, and for each using a key, ezcept jsonarray which is an array inside.
    Last: Do tests for searching & retrieving. How fast can be, for a 5 parts path, for an array with some null inside, for specific indexes, and for an object for specific keys.

  2. #42

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: [RESOLVED] JSON-Decoding of RC5/RC6

    Thank you very much, georgekar.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width