Build a new JSON shape from parsed fields.

Reshaping Data

reshape_data.js
const tax = 2;
const text = "{\"subtotal\":20,\"customer\":\"Lee\"}";
const customer = JSON.parse(text).customer;
const total = JSON.parse(text).subtotal + tax;
const summary = JSON.stringify({ customer: customer, total: total });

console.log("tax=" + tax);
console.log("summary=" + summary);
reshape-data Programs often parse one shape, compute a few values, and stringify a smaller shape for the next step.