West Wind Internet and Client Tools
Get a key from a json format string
Gravatar is a globally recognized avatar based on your email address. Get a key from a json format string
  Dmitry Litvak
  All
  Dec 22, 2016 @ 07:40am

Good morning.

I have two questions, please.

  1. How do I extract a key value from a json format string? I presume I need to use wwjSonSerializer class, right?

  2. Can a json format string be converted to a VFP cursor? If yes, how?

TIA

Gravatar is a globally recognized avatar based on your email address. re: Get a key from a json format string
  Rick Strahl
  Dmitry Litvak
  Dec 22, 2016 @ 11:33pm

You don't extract a 'key' from a JSON string. JSON is either a value, object, or collection and yes you can use wwJsonSerializer to deserialize a JSON string into an object (or value or collection).

You can't directly convert a JSON object to a cursor, but you shouldn't need to. Most likely the result data is a collection and you can iterate through that.

Here's more info on serialization formats:

You can't directly deserialize to a cursor, but you can use CollectionToCursor() to turn a JSON result collection into a cursor if the table/db exists and is open. The link has more info.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Get a key from a json format string
  Dmitry Litvak
  Rick Strahl
  Dec 23, 2016 @ 01:31pm

Thank you very much for your help!

© 1996-2024