I'm using FlexJSON(but I'm open to other libraries) and I want to manually build a json array. I have certain things that I need to add that are not part of the model that is being serialized. For instance I want to add an html column and css column to my json array. This data would be determined by iterating through the list and seeing if the values are above or below a certain number.
Right now I just have this.
JSONSerializer json = new JSONSerializer();
json.transform(new DateTransformer("MM/dd/yyyy hh:mm:ss"), "timeStamp");
json.transform(new DecimalTransformer("#.00") , "ounces");
json.include("timeStamp", "ounces");
json.exclude("*");
json.prettyPrint(true);
response.setContentTypeIfNotSet("application/json");
response.out.write(json.serialize(list).getBytes());
But I want to manually build this array instead of just calling serialize. Say the ounces number is below a certain number then that should change the value of the css column. The css column is not part of the object(model) so I need to manually add that too. Thanks.