Ziyad VK
Ziyad VK

Reputation: 1

VBA code for creating a specific JSON File

Anybody create the Excel VBA code for the following json file ?

   "Version": "1.1",    
    "TranDtls": {   
        "TaxSch": "GST",    
        "SupTyp": "B2B",    
        "IgstOnIntra": "N", 
        "RegRev": "N",  
        "EcmGstin": null    
    },  
    "DocDtls": {    
        "Typ": "INV",   
        "No": "1",  
        "Dt": "21/10/2022"  
   

Excel VBA code for the JSON file CREATION

Upvotes: 0

Views: 379

Answers (1)

Daniel Sanders
Daniel Sanders

Reputation: 24

We need some more information to help you find the correct answer. Do you want to read/import this json string or do you want to have Excel create such a string for export?

You can use the VBA-JSON module from github. A simple way to create the string is to copy paste it into a string variable and use the Replace function;

sTemp = "...      "TaxSch": "[TaxSch]",....  
sJson = Replace(sTemp,"[TaxSch]", Yourvalue)

Or you could use concatenation but that will be more difficult with all the quotes.

Upvotes: 1

Related Questions