Note that there are some explanatory texts on larger screens.

plurals
  1. POSelecting the most efficient JSON library for this use case
    text
    copied!<p>I have a JSF grid type component where each cell is individually editable and the data for each cell is contained in a POJO called DataObject(DO) . The structure of DO is like this :</p> <pre><code>public class DO { //Id should be the coordinate. eg x@y . x is the row position and y is the column position private String id; //This is value that goes to the client after applying formatter private Object value; //flag to indicate whether the cell will be disabled private boolean disabled; //flag to indicate whether the cell will be rendered private boolean rendered=true; //Editor type for the cell private String editorType; } </code></pre> <p>So basically <code>id</code> field identifies the cell position(row and column) in the grid.</p> <p>Now in our case we can have a 1000 row X 100 column grid where the grid itself is sparsely populated initially meaning that most of the cells do not contain any DO intially. So about 30% of those cells will contain data and the rest will not contain any data. I need to pass the data in JSON format from the server to the client javascript via ajax. The idea is to iterate through the collection of DO's and construct the JSON String .</p> <p>So the JSON for a grid that has data for two cells would look something like this :</p> <pre><code>{ id1 : { editorType:'InputEditor', value:'1234123', disabled:'false', rendered:'true' }, id2 : { editorType:'SomeCustomEditor', value:'23456', disabled:'true', rendered:'true' } } </code></pre> <p>What existing JSON Java library can I use here to produce this output JSON in the most efficient way ? Any example code will help here .</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload