× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello list,
Has anyone encountered a situation where they had to parse a CSV file that contained JSON strings in one of the "fields"?
I am using Scott Klement's CSVR4 service program to parse a CSV file and I'm wondering if it is possible to ensure the JSON strings that are in the file retain double quotes.
Here's a sample row of the CSV I am dealing with.

"Bill Ding","123 Mockingbird Lane","Some City", "MN", "90210"," [{"pricelineType":"ITEM","amount":"19.95","currency":"USD"},{"pricelineType":"SHIPPING","amount":"5.95","currency":"USD"}]"

After opening and loading the CSV file, the results are as follows (I will list each field on its own row for read-ability:
Bill Ding
123 Mockingbird Lane
Some City
MN
90210
[{pricelineType:ITEM,amount:19.95,currency:USD},{pricelineType:SHIPPING,amount:5.95,currency:USD}]

I am omitting string and field delimiters when calling CSV_open, so doubles are used for field delimiters and a comma is used for the field delimiter.

The problem is that I cannot successfully parse the JSON because the double quotes are missing.


My 2 cent are I don't know why anyone would imbed JSON strings in a comma separated file, but that is out of my control in this situation.
Any ideas would be greatly appreciated.

Thanks,
Grizzly





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.