Thank you, My revised function looks like this: def json_parameters(param_names): """takes an array of parameter names which are attributes to a design cell then looks up the default value and unit in the attributes table and returns an array of json dictionary objects to be inserted in the cell's parameters field as a json object if param_names = ["L", "len", "R", "INST", "model", "REF"] { "L": { "value": "0.001", "unit": "nH" }, "len": { "value": "1", "unit": "??m" }, "R": { "value": "0.5", "unit": "Ohm" }, "INST": { "value": "i", "unit": "TEXT" }, "model": { "value": "m", "unit": "TEXT" }, "REF": { "value": "r", "unit": "TEXT" } } } """ params={} for a in param_names: # dbg.set_trace() rows = db(db.attribute.name.lower()==a.lower()).select(db.attribute.name, db.attribute.default_value, db.attribute.unit) row = rows[0].as_dict() param=dict(value=row['default_value'],unit=row['unit']) named={row['name']:param} params.update(named) # return json(params)
On Sunday, January 20, 2013 5:01:35 AM UTC-6, Alan Etkin wrote: > > CONTROLLER FUNCTION: (the myobj value is copied from my cell's edit page >> after being inserted into my Oracle DB. >> > > The json field type does not validate insert/update for values stored > programatically, validation is performed when you send values with the json > widget. However, you could validate your input this way: > > > >>> print IS_JSON()("No JSON")[1] is None > False > >>> print IS_JSON()('{"a": 1, "b": 2}')[1] is None > True > > --