closed JSON-formatted content
Don't need
initialize the records in the bag
Same as above (also visible below complete code related section)
Add the name value of all records in bag to a string
< for bags=Item End="@{item:getlength}"> <if x="@{item:getsuffix}" else=1> <bag id=pPage x=0><we name=name>"@{item:name}"</We></bag> <bag id=pPage><we name=name>@{ppage:name}, "@{item:name}"</We></bag> </if></for >
An array of output values is added directly to the string output.
Output
[@{pPage:name}]
Results
["土豆","T恤","可乐","书"]
Full code
<cHTML><!--Data Preparation section, you can query from the database--<bag id=item suffix=0> <we name=name>Potatoes</We> <we name=price >1.24</We> <we name=Unit>KG</We></bag><bag id=item suffix=1> <we name=name>Shirt</We> <we name=price >68</We> <we name=Unit>Thing</We></bag><bag id=item suffix=2> <we name=name>Coke</We> <we name=price >2.20</We> <we name=Unit>Bottle</We></bag><bag id=item suffix=3> <we name=name>Book</We> <we name=price >51.24</We> <we name=Unit>This</We></bag></cHTML><cHTML><!--formal JSON-formatted content, output only an array of values directly into the string output.< for bags=Item End="@{item:getlength}"> <if x="@{item:getsuffix}" else=1> <bag id=pPage x=0><we name=name>"@{item:name}"</We></bag> <bag id=pPage><we name=name>@{ppage:name}, "@{item:name}"</We></bag> </if></for ></cHTML>[@{ppage:name}]
Example file _samples/app/array_only_value.json in the _samples/app/directory of the light-open platform
Related Resources Download:
Mobile app server development from getting started to mastering: http://download.csdn.net/detail/tx18/8741611
Quickly build a mobile App server: http://download.csdn.net/detail/tx18/8737507
Light on the platform will not be regularly upgraded to provide you with more powerful and easy features, please pay attention to download the latest version: http://download.csdn.net/user/tx18
All records in the output bag are a JSON array with only values---proficient in Android, IOS app service program development