[TIMOB-9943] TiAPI: please add a method to return all properties, their types, and values, as a JSON string
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 2.1.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | api, community |
Reporter | Shawn Lipscomb |
Assignee | Unknown |
Created | 2012-07-03T07:35:44.000+0000 |
Updated | 2018-02-28T20:03:30.000+0000 |
Description
Ti.App.Properties has a listProperties() method that returns an array of (string) property names. However, there is no way to know the data type (boolean, double, int, list, object, string) of each property. Therefore, code cannot determine which getXxxxx method to call to obtain a given property's native value.
Please add a method to return all properties, their types, and values, as a JSON string, or alternately as an array of objects (where each object has PropertyName, PropertyType, and PropertyValue properties). Perhaps this new method could be called toJSON().
Example:
[{ PropertyName:"FirstProp", PropertyType:"string", PropertyValue:"Hello World" },
{ PropertyName:"AnotherProp", PropertyType:"boolean", PropertyValue:true},
{ PropertyName:"SomeNumber", PropertyType:"int", PropertyValue:42 },
{ PropertyName:"MoneyAmt", PropertyType:"double", PropertyValue:123.45 }]
No comments