Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9943] TiAPI: please add a method to return all properties, their types, and values, as a JSON string

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 2.1.0
Fix Version/sn/a
ComponentsiOS
Labelsapi, community
ReporterShawn Lipscomb
AssigneeUnknown
Created2012-07-03T07:35:44.000+0000
Updated2018-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 }]

Comments

No comments

JSON Source