Re: JSON Format and VFP 8 or 9

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



John Germany schrieb:
Hi everyone,
A supplier for my company has changed the format on a file that we regularly download and extract into our VFP 8 tables to the JSON format. See here for details...http://www.json.org/

Here is part of a sample file...

{page:'1',count:'10000',list:[{code:'10000',name:'Kits O-Ring Replacement',upc1:'037155399895',upc2:'',upc3:'',supp:'01809',mfg:'39989',uom:'KT',disc:false,comm:false,min:1,mult:1,pack:1}],total:34488}


Does anyone have any VFP code that will extract this file into a table? Any ideas without writing code using fget().
Thanks, John


Dunno how much data is sent that way, but if speed is not of the utmost essence, I'ld investigate if you can use an implementation which walks the object tree build from the json data.

As there are different jason dialects/implementations, chances are that you will receive sometime in the future data following slightly altered patterns. Instead of fine-tuning your parsing code you could (hopefully) build also an object from thatlist without no or at least much less code changes.

As long as it is only a couple of thousand elements it should not matter, but if you receive data high in the million range the speed penalty will probably prohibitive.
.



Relevant Pages

  • Re: JSON Format and VFP 8 or 9
    ... A supplier for my company has changed the format on a file that we regularly download and extract into our VFP 8 tables to the JSON format. ... Does anyone have any VFP code that will extract this file into a table? ...
    (microsoft.public.fox.programmer.exchange)
  • Re: tt:mm:ss interferes with defined range?
    ... In Column data format select Do not import ... This will extract the unique dates in ascending order. ... You can use this data for you chart. ... Microsoft Excel MVP ...
    (microsoft.public.excel)
  • Re: Exporting DV using Toast
    ... presents, so I extracted the footage from them in DV format using Toast, ... edited them using Final Cut Pro, and mastered and burnt them using iDVD. ... went well until playing the final disc image with DVD player, ... I've used Toast because it seems to be the only thing that will extract DV ...
    (uk.comp.sys.mac)
  • Re: What is the preferred way to parse messages out of a log?
    ... I need to extract the values of the message and ... format, provide searching and message grouping by the dialogID. ... Trunk Group ID: 00000001 ... If you are comfortable with Java tools for XML you might look into ...
    (comp.lang.java.help)
  • Re: Suggestions for extracting masked selections and generating XML
    ... Then it would be quite simple to extract the data, without even needing to know much about the layout. ... Alternatively, you could take the documents to a document scanning company with the software to create masks to recognise the data fields. ... In each of the format files, the data is in a different ... make a selection and somehow "tag" it as if to say "this area ...
    (microsoft.public.office.misc)