Subject Re: csv field data
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Wed, 14 Jul 2021 10:31:35 -0700
Newsgroups dbase.getting-started

On 7/14/2021 7:02 AM, Charlie wrote:
> Yes it is a json which I am absolutely not familiar with.  I am still using 11.
>
> Gaetano D. Wrote:
>
>> On 13/07/2021 22:58, Charlie wrote:
>>> I hace a program that Myrvin helped me with a while ago.  Basically all it is doing is taking data that I have replaced into fields in a table and converting the data to a csv file.  That is easy to do igf it is cut and dry data.  But I need to put av array in the postage column.  It is like this:  {"price":["5.00","10.00"],"method":["Standard","Priority"]}
>>>
>>> Of course the commas are screwing up the columns.  Is there a way of changing this statement so that the commas will not interfere with the structure of the csv file?
>>>
>>> Thanks for any help
>>>
>>>
>> That structure is a JSON, do you have dBase 2019? I think I have a demo
>> code that I may be able to tweak to export this JSON to CSV but won't
>> have time to look into it until tomorrow evening.

dBASE 2012 is where the JSON control first appeared. Unfortunately
arrays are tricky unless you are using something that can interpret JSON.

Charlie -- are you writing this out to send to someone else? If so, you
can build the JSON data yourself. If you need to read it in, ... well,
that's different. If you need to generate the JSON data, you know the
format, just build the strings *as* JSON, not as CSV. (By the by,
"Commas are screwing up the columns" -- because "CSV" stands for "Comma
Separated Values", so of course they would throw things off ...)

Ken


--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm


Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0