Last active
December 15, 2015 23:58
-
-
Save czy88840616/5343715 to your computer and use it in GitHub Desktop.
问题:从模板中推导出正确的json结构
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set($orderList = $!{result.orderList}) | |
#foreach($order in $!orderList) | |
#set($shop = $!{order.shop}) | |
$!{shop.singleItemId} | |
#end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"result": { | |
"orderList": [ | |
{ | |
"shop": { | |
"singleItemId": "" | |
} | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1、先把变量转成对象
2、一旦碰到变量只有一个字符串,并且在foreach或者set中的,就移动一次对象(因为此时实质上的变量应该已经都变成一个大对象了,移动的只是这个对象)
这个逻辑不知道对不对。。待实验