skip to Main Content

This is regarding an issue I’m facing in Report-based Export in JSON Format from Tally Prime for Integration Using JSON.

We need to have the HTTP POST Request as per the below format/example:
[ { "customerCode":"Asc871", "customerName":"asxcshwha", "currencyCode": "IDR", "longestDay": 13, "month": 7, "noteInfo": "222222", "overduePayment": 20, "paymentTerm": 5, "receivableBalance": 35, "sameMonthAmount": 10, "sameMonthPayment": 10, "sameYearIncome": 10, "thanNinetyOverdueAmount": 10, "thanSixtyOverdueAmount": 10, "thanThirtyOverdueAmount": 10, "year": 2022, "yearYtdPayment": 10 } ]
HTTP POST Request format

However on generating the JSON data from Tally Prime it is being exported as below:
{ "": [ { "batchId": "00000", "customerCode": "Customer A", "customerName": "Customer A", "currencyCode": "QAR", "year": "2024", "month": "7", "receivableBalance": "355.00", "overduePayment": "0", "paymentTerm": "30 Days", "thanNinetyOverdueAmount": "355.00", "yearYtdPayment": "0", "sameYearIncome": "0" }, { "batchId": "00000", "customerCode": "Customer B", "customerName": "Customer B", "currencyCode": "QAR", "year": "2024", "month": "7", "receivableBalance": "320.00", "overduePayment": "0", "paymentTerm": "0", "thanNinetyOverdueAmount": "320.00", "yearYtdPayment": "0", "sameYearIncome": "0" }, { "batchId": "00000", "customerCode": "Customer C", "customerName": "Customer C", "currencyCode": "QAR", "year": "2024", "month": "7", "receivableBalance": "60.00", "overduePayment": "0", "paymentTerm": "0", "thanNinetyOverdueAmount": "60.00", "yearYtdPayment": "0", "sameYearIncome": "0" } ] }

You can notice the extra tags(with flower brackets) ({ "":) in the beginning of the JSON data in the above example comparing it with the format required. I.e., The JSON data format needs to start with the square brackets whereas it is starting with the flower brackets(curly braces).
Could someone please guide me on how to remove those extra tags in the JSON data generated from Tally.

The below is the TDL code to understand the way the JSON Report is being constructed in Tally:

`[Report    : ReportBasedExportInJSONFormatTestRep] 
    
    Form    : UDDahuaIntegUpldAcctRcvbleJSONRep
    
    [Form   : UDDahuaIntegUpldAcctRcvbleJSONRep]
        
        Part    : UDDahuaIntegUpldAcctRcvbleJSONRepBody
        
        JSONTag : ""
        
        [Part   : UDDahuaIntegUpldAcctRcvbleJSONRepBody]
            
            Line    : UDDahuaIntegUpldAcctRcvbleJSONRepBody
            Repeat  : UDDahuaIntegUpldAcctRcvbleJSONRepBody : UDDahuaIntegAcctRcvbleRepUpldColl
            
            Scroll  : Vertical
            
            [Line   : UDDahuaIntegUpldAcctRcvbleJSONRepBody]
                
                Line    : UDDahuaIntegUpldRcvbleOSJSONRepBatchId    
                
                JSONTag : ""

                                 [Line  : UDDahuaIntegUpldRcvbleOSJSONRepBatchId]   
                    
                    Field   : Simple Field
                    Local   : Field : Simple Field  : JSONTag   : "batchId"
                    Local   : Field : Simple Field  : Set as    : "0000"`

TDL code for the JSON Report being constructed`

2

Answers


  1. As I mentioned in comment tally TDL does not support list tag as root Tag
    you can refer this means you cannot read or write list Json using TDL

    Since you cannot change the server API structure
    you can use any other language as intermediary between tally and your server

    Say C#:
    using XML API, you can get data from tally and transform using C# according to server format and post data to server

    Login or Signup to reply.
  2. First of all, you can’t export data in JSON array without root Tag from Tally.
    As your HTTP Request you can’t export that format data from the tally.

    Solutions for this
    At the Part Level Define the JSON tag then only you will export the data.
    So new HTTP Body Will be like this
    { "entries": [ { "customerCode":"Asc871", "customerName":"asxcshwha", "currencyCode": "IDR", "longestDay": 13, "month": 7, "noteInfo": "222222", "overduePayment": 20, "paymentTerm": 5, "receivableBalance": 35, "sameMonthAmount": 10, "sameMonthPayment": 10, "sameYearIncome": 10, "thanNinetyOverdueAmount": 10, "thanSixtyOverdueAmount": 10, "thanThirtyOverdueAmount": 10, "year": 2022, "yearYtdPayment": 10 }

    If you don’t want to define the Root Tag then there is another simple solution you can Create one DLL File and connect it with the TDL Using COM Interface.

    Still you need more help please contact me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search