All records in the output bag are a JSON array---proficient in Android, IOS app service program development

Source: Internet
Author: User
Tags app service

Write a closed JSON-formatted content

{“item”:    {<chtml>… …</chtml>    } ,"tatol":@{item:getLength}}

Organize a complete JSON-formatted text output to the Android (IOS) App with the results of the label running on the inner layer

"tatol":@{item:getLength}

Is the number of statistical records

initialize the records in the bag
Previous Blog
(You can also query from a database, such as)

<esql module=help id=item>Select    ID,Subject,Writer,DayTime,Body  From        Messages</esql>

All records in the output bag

< for bags=Item End="@{item:getlength}">    <item list="@{item:getsuffix}" end="@{item:getlength}">     <!--The List property parameter indicates that the output is in an array-list format, and the end property parameter represents the position of the end of the arrays (equal to the For end value) -        <name>@{item:name}</name>        < price value>@{item:price}</price ><!--The Value property parameter indicates the output without quotation marks--        <unit>@{item:unit}</Unit>    </Item></for >

The List property parameter indicates that the output is in an array-list format, and the end property parameter represents the position of the end of the arrays (equal to the for end value)

Results

{"Items":{"Item":[{"name":"Potatoes"," Price":1.24,"Unit":"KG"},{"name":"T-shirt"," Price": the,"Unit":"Pieces"},{"name":"Coke"," Price":2.20,"Unit":"Bottle"},{"name":"book"," Price":51.24,"Unit":"Ben"}]},"Tatol":4}

Full code

{"Items": {<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 format content--< for bags=Item End="@{item:getlength}">    <item list= "@{item:getsuffix}" end="@{item:getlength}" >    <!--The List property parameter indicates that the output is in an array-list format, and the end property parameter represents the position of the end of the arrays (equal to the For end value) -        <name>@{item:name}</name>        < price value>@{item:price}</price ><!--The Value property parameter indicates the output without quotation marks--        <unit>@{item:unit}</Unit>    </Item></for ></cHTML>}, "Tatol": @{item:getlength}}

Example file _samples/app/one_array.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---proficient in Android, IOS app service program development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.