Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2012
    Posts
    7

    Unanswered: Convert .json file to .xml or .csv or another table reading extension

    hello

    I have a .json file that I need to convert to .csv or .xml, some format that I can put into a table or spreadsheet. What is the easiest way to do that? I do not know how to code or anything so trying to run it through java or something like that is going over my head. Is there a way? Ill attach the file if someone can help a newbie out.
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511
    The attached Excel 2003 workbook has code in a module that reads the Apparel text file, which I renamed to Apparel.txt, and writes
    the data to another text file. It took a little over 200 lines of code to do this.

    The one field you have a problem with is the Description field, where some of the text includes unreadable characters, and doing
    a straight import into MS Access saw some truncation as well.

    If all the data is like the sample you provided, the code should work. The code processes each record type (see record type list below)
    and manipulates each type according to the format needed for that field, or fields, in the output file. Record types are processed in order,
    for example, when the text "placement" is encountered, that triggers the end of processing of Size data, and the code moves on to do
    Placement data.

    Each apparel item is numbered in the output, so your "fleece-hoody" item and all the data lines associated with it are record #1.

    I hope this helps. After renaming and copying Apparel.txt to c:\Temp, this is the function you can run. I am posting just a few
    lines from the top of Module2.
    Code:
    Function WriteCSV_File()
    'read a file, put comma-delimited data fields in text file (outFile).
    'assumes all "keeper" data lines start with alpha or numeric character
    'and all data is in consistent order as in the sample provided.
    '* *************************************************************** *
    '* Input File: c:\Temp\Apparel.txt                                 
    '* Output File: c:\Temp\Output.txt                                 
    '* Record Type Codes:                                              
    '* 0 = Apparel_Name                                                
    '* 1 = Apparel_sub-name (optional)                                 
    '* 2 = Colors                                                      
    '* 3 = Description                                                
    '* 4 = Sizes                                                       
    '* 5 = Placement                                                   
    '* 6 = Price                                                       
    '*                                                                 
    '* Note: Description text contains double quotes and non-readable  
    '* characters. Description field produced an ImportError table     
    '* when importing to MS Access.                                    
    '*                                                                 
    '* *************************************************************** *
    Attached Files Attached Files
    Last edited by JerryDal; 07-25-12 at 01:43.

  3. #3
    Join Date
    Jul 2012
    Posts
    7
    Quote Originally Posted by JerryDal View Post
    The attached Excel 2003 workbook has code in a module that reads the Apparel text file, which I renamed to Apparel.txt, and writes
    the data to another text file. It took a little over 200 lines of code to do this.

    The one field you have a problem with is the Description field, where some of the text includes unreadable characters, and doing
    a straight import into MS Access saw some truncation as well.

    If all the data is like the sample you provided, the code should work. The code processes each record type (see record type list below)
    and manipulates each type according to the format needed for that field, or fields, in the output file. Record types are processed in order,
    for example, when the text "placement" is encountered, that triggers the end of processing of Size data, and the code moves on to do
    Placement data.

    Each apparel item is numbered in the output, so your "fleece-hoody" item and all the data lines associated with it are record #1.

    I hope this helps. After renaming and copying Apparel.txt to c:\Temp, this is the function you can run. I am posting just a few
    lines from the top of Module2.
    Code:
    Function WriteCSV_File()
    'read a file, put comma-delimited data fields in text file (outFile).
    'assumes all "keeper" data lines start with alpha or numeric character
    'and all data is in consistent order as in the sample provided.
    '* *************************************************************** *
    '* Input File: c:\Temp\Apparel.txt                                 
    '* Output File: c:\Temp\Output.txt                                 
    '* Record Type Codes:                                              
    '* 0 = Apparel_Name                                                
    '* 1 = Apparel_sub-name (optional)                                 
    '* 2 = Colors                                                      
    '* 3 = Description                                                
    '* 4 = Sizes                                                       
    '* 5 = Placement                                                   
    '* 6 = Price                                                       
    '*                                                                 
    '* Note: Description text contains double quotes and non-readable  
    '* characters. Description field produced an ImportError table     
    '* when importing to MS Access.                                    
    '*                                                                 
    '* *************************************************************** *
    Wow, thanks a ton for the help. That's really kind of you to go through that file and work it out. Do I need to have Excel 2003 for the file to open properly? I have 2008 and it's telling me when opening the file that macros are included and apparently those aren't kosher with '08 version.

  4. #4
    Join Date
    Jan 2002
    Location
    Bay Area
    Posts
    511
    I have no knowledge of how the Macintosh works or Excel version 2008 for the MAC, other than what I just now researched. Your Excel 2008
    on the Mac will not run Excel 2003 VBA code, which was designed to work with Sheet1 in the workbook, and files in the Windows environment.

    I found your data conversion problem to be an interesting challenge, and one that brought satisfaction in completing it.
    If you want to see the VBA code, it is in the attached text file.
    Jerry
    Attached Files Attached Files

Posting Permissions

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