I have 52 keys and pairs in my JSON data, and I want to parse it, but the APEX method only supports 35 arguments to the method. Then how can I parse large JSON data with the APEX class?
My JSON is:
{"products":[{
"title":"SPF 50 for Body & Face 3-Pack",
"id":1952,
"created_at":"2015-11-19T23:12:45Z",
"updated_at":"2016-04-08T20:37:12Z"
....... up to 52 key pair ....
},
{
"title":"SPF 50 for Body & Face 3-Pack",
"id":1952,
"created_at":"2015-11-19T23:12:45Z",
"updated_at":"2016-04-08T20:37:12Z"
....... up to 52 key pair .....
},
{
"title":"SPF 50 for Body & Face 3-Pack",
"id":1952,
"created_at":"2015-11-19T23:12:45Z",
"updated_at":"2016-04-08T20:37:12Z"
....... up to 52 key pair ....
}]}
My parser is:
List<WooProductModel> productList = new List<WooProductModel>();
while (parser.nextToken() != null) {
if (parser.getCurrentToken() == JSONToken.START_ARRAY) {
while(parser.nextToken() != null) {
if(parser.getCurrentToken() == JSONToken.START_OBJECT) {
WooProductModel product = (WooProductModel)parser.readValueAs(WooProductModel.class);
productList.add(product);
System.debug('data: ' + productList);
}
}
}
}
My apex class is:
public class WooOrdersParser {
/* I need to pass 52 arguments as my JSON has 52 key pair values */
public WooOrdersParser(String id, .... only upto 32 argument ...) {
}
}