- Zhang JX
- SnapDevelop
- Monday, 6 June 2022 04:38 AM UTC
Hi all,
I am trying to work on API service for our ERP system Invenotry function, need make use of nested Json structure to pass values:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace NDYAPI
{
public class StockAdj
{
public string doc_format = "YYMM";
public string coy_code;
public string doc_type;
public string status_code = "P";
public string requester_code;
public string requester_name;
public DateTime requested_date;
public string invoice_code = "";
public int doi_num = 0;
public string remarks;
public string reason_code;
public int item_count;
public StockAdjitem[] adjitems;
}
public class StockAdjitem
{
public int item_num;
public string trans_type;
public string prod_code;
public string prod_to;
public string part_code;
public string part_to;
}
}
While incurring "Exception Thrown" with "System.NullReferenceException: Object reference not set to an instance of an object." when setting the value to nested sub items.
am i missed something with the class defination ?
Thank you.
Zhang
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.