0

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
  • 1
    as of now tally TDL doesn't support list as root tag either change your format in server or use other language instead of TDL Commented Jul 17, 2024 at 12:31
  • 1
    Dear Mr.Sai Vineeth thank you for your response. Actually we are unable to change the format in server as it is a standard format used by a company for all it's customers. Would you be able to provide me with more inputs to use different language other than TDL ? I'm basically a TDL Programmer and so struggling a bit googling to understand how the job can be done using a different language. Basically in the HTTP POST Request from Tally the output to be JSON data which is directly as an array format without an enclosing object. Commented Jul 17, 2024 at 14:04

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

1 Comment

Thank you both for your valuable advise & support. Actually since it was not possible in Tally directly through TDL, finally the vendor company has agreed to modify their API to accomodate the JSON structure supported by Tally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.