Skip to content

Noodle stringify() Method

Dan Kranz edited this page Sep 23, 2021 · 2 revisions

Create a JSON string representation of the dataset for data exchange or saving. Rows marked for deletion are removed from the dataset before creation of the output string.

One may customize this method by defining a stringify function in the dataset object.

Syntax

stringify()

Parameter Values

None

Example

var items = [
  ["1","Vegetable","Tree","1"],
  ["2","Animal","Bird","1"],
  ["3","Mineral","Diamond","1"],
  ["4","Vegetable","Flower","1"],
  ["5","Vegetable","Grass","1"],
  ["6","Animal","Cat","1"],
  ["7","Animal","Dog","1"],
  ["8","Mineral","Ruby","1"],
  ["9","Mineral","Quartz","1"]
];
var db1 = new Noodle(items, ["Seq","Category","Item","Count"]);

// Create a JSON string from the dataset
var output = db1.stringify();

Output string

[ ["1","Vegetable","Tree","1"], ["2","Animal","Bird","1"], ["3","Mineral","Diamond","1"], ["4","Vegetable","Flower","1"], ["5","Vegetable","Grass","1"], ["6","Animal","Cat","1"], ["7","Animal","Dog","1"], ["8","Mineral","Ruby","1"], ["9","Mineral","Quartz","1"] ]

Clone this wiki locally