-
-
Save jadeallenx/1994346 to your computer and use it in GitHub Desktop.
Revisions
-
Mark Allen revised this gist
Mar 14, 2012 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -28,9 +28,7 @@ process_value(Value, to_binary) -> list_to_binary(Value); process_value(Value, _) -> Value. element_text_content(#xmlElement{}=Element) -> Content = Element#xmlElement.content, case Content of [] -> undefined; -
Mark Allen revised this gist
Mar 14, 2012 . 2 changed files with 20 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,12 @@ # Purpose This module takes XML and turns it into a deep proplist. The original code was written by @wackum. I modified it so it: * returns both attributes and the value instead of one or the other * doesn't ignore the top level tag * handles elements with empty content # Example xml This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,10 @@ %% Turn XML into a deep proplist %% %% Original code by @wackum %% %% Copyright (C) 2012 by Mark Allen. All rights reserved. %% %% You may use this software under the MIT license as explained in the README -module(beenzaxml). -export([process_xml/2]). @@ -31,9 +28,16 @@ process_value(Value, to_binary) -> list_to_binary(Value); process_value(Value, _) -> Value. element_text_content(#xmlElement{}=Element) -> io:format("Element> ~p~n", [Element]), Content = Element#xmlElement.content, io:format("Content> ~p~n", [Content]), case Content of [] -> undefined; _ -> ContentHead = hd(Content), ContentHead#xmlText.value end. process_xml(Element, Rules) -> TagName = Element#xmlElement.name, @@ -46,5 +50,5 @@ process_xml(#xmlElement{name=TagName} = Element, {TagName, _AttributesRules, Chi ] ++ State; process_xml(#xmlElement{} = Element, Rule, _State) -> {_TagName, _AttributeRules, ChildRules} = Rule, [{content, process_value(element_text_content(Element), ChildRules)}]; process_xml(_, _, State) -> State. -
Mark Allen revised this gist
Mar 13, 2012 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -70,7 +70,7 @@ test() -> Will return easy-to-use deep proplist: ```erlang [{configuration, [{application, [{id,test}, {platform, @@ -89,7 +89,7 @@ Will return easy-to-use deep proplist: {package, [{points,290}, {price,5000}, {id,vk4}]}]}]}]}]}] ``` This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -37,7 +37,7 @@ element_text_content(#xmlElement{}=Element) -> process_xml(Element, Rules) -> TagName = Element#xmlElement.name, [{TagName, process_attributes(Element, Rules) ++ process_xml(Element, Rules, [])}]. process_xml(#xmlElement{name=TagName} = Element, {TagName, _AttributesRules, ChildrenRules}, State) when is_list(ChildrenRules) -> [{ElTag, process_attributes(El, Rule) ++ process_xml(El, Rule, State)} || #xmlElement{name=ElTag} = El <- Element#xmlElement.content, -
Mark Allen revised this gist
Mar 12, 2012 . 2 changed files with 29 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Purpose This module takes XML and turns it into a deep proplist. The original code was written by @wackum. I modified it so it returns both attributes and the value instead of one or the other and doesn't ignore the top level tag. # Example xml @@ -70,23 +70,26 @@ test() -> Will return easy-to-use deep proplist: ```erlang {configuration, [{application, [{id,test}, {platform, [{id,vk}, {appId,[{value,<<"123">>}]}, {secretKey,[{value,<<"secret">>}]}, {packages, [{package,[{points,3},{price,100},{id,vk0}]}, {package,[{points,20},{price,500},{id,vk1}]}, {package, [{default,true}, {points,45}, {price,1000}, {id,vk2}]}, {package,[{points,130},{price,2500},{id,vk3}]}, {package, [{points,290}, {price,5000}, {id,vk4}]}]}]}]}]} ``` This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,11 +11,12 @@ -module(beenzaxml). -export([process_xml/2]). -include_lib("xmerl/include/xmerl.hrl"). process_attributes(#xmlElement{attributes=Attributes}, Rules) -> {_, AttributeRules, _} = Rules, lists:foldl(fun (Attr, Acc) -> process_attribute(Attr, Acc, AttributeRules) end, [], Attributes). process_attribute(#xmlAttribute{} = Attribute, State, Rules) -> Name = Attribute#xmlAttribute.name, @@ -34,14 +35,16 @@ element_text_content(#xmlElement{}=Element) -> ContentHead = hd(Content), ContentHead#xmlText.value. process_xml(Element, Rules) -> TagName = Element#xmlElement.name, {TagName, process_attributes(Element, Rules) ++ process_xml(Element, Rules, [])}. process_xml(#xmlElement{name=TagName} = Element, {TagName, _AttributesRules, ChildrenRules}, State) when is_list(ChildrenRules) -> [{ElTag, process_attributes(El, Rule) ++ process_xml(El, Rule, State)} || #xmlElement{name=ElTag} = El <- Element#xmlElement.content, {RuleTag, _, _}=Rule <- ChildrenRules, RuleTag==ElTag ] ++ State; process_xml(#xmlElement{} = Element, Rule, _State) -> {_TagName, _AttributeRules, ChildRules} = Rule, [{value, process_value(element_text_content(Element), ChildRules)}]; process_xml(_, _, State) -> State. -
Mark Allen revised this gist
Mar 7, 2012 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -26,10 +26,10 @@ This module takes XML and turns it into a deep proplist. The original code was # Usage example ```erlang -module(t). -export([test/0]). test() -> XmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <configuration> <application id=\"test\"> -
Mark Allen revised this gist
Mar 7, 2012 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,9 +4,9 @@ This module takes XML and turns it into a deep proplist. The original code was # Example xml ```xml <?xml version="1.0" encoding="UTF-8" ?> <configuration> <application id="test"> <platform id="vk"> <appId>123</appId> @@ -20,8 +20,8 @@ This module takes XML and turns it into a deep proplist. The original code was </packages> </platform> </application> </configuration> ``` # Usage example -
Mark Allen revised this gist
Mar 7, 2012 . 1 changed file with 7 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,7 @@ This module takes XML and turns it into a deep proplist. The original code was # Example xml ```xml <?xml version="1.0" encoding="UTF-8" ?> <configuration> <application id="test"> @@ -20,9 +21,11 @@ This module takes XML and turns it into a deep proplist. The original code was </platform> </application> </configuration> ``` # Usage example ```erlang -module(t). -export([test/0]). @@ -62,11 +65,11 @@ This module takes XML and turns it into a deep proplist. The original code was }] }, beenzaxml:process_xml(Element, Rules). ``` Will return easy-to-use deep proplist: ```erlang [{application, [{id,test}, {platform, @@ -85,7 +88,7 @@ Will return easy-to-use deep proplist: {package, [{points,290},{price,5000},{id,vk4}]}]}]}]}] ``` ## LICENSE -
Mark Allen revised this gist
Mar 7, 2012 . 1 changed file with 42 additions and 39 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,46 +1,48 @@ # Purpose This module takes XML and turns it into a deep proplist. The original code was written by @wackum. I modified it so it returns both attributes and the value instead of one or the other. # Example xml <?xml version="1.0" encoding="UTF-8" ?> <configuration> <application id="test"> <platform id="vk"> <appId>123</appId> <secretKey>secret</secretKey> <packages> <package id="vk0" price="100" points="3" /> <package id="vk1" price="500" points="20" /> <package id="vk2" price="1000" points="45" default="true" /> <package id="vk3" price="2500" points="130" /> <package id="vk4" price="5000" points="290" /> </packages> </platform> </application> </configuration> # Usage example <pre><code class="erlang"> -module(t). -export([test/0]). test() -> XmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <configuration> <application id=\"test\"> <platform id=\"vk\"> <appId>123</appId> <secretKey>secret</secretKey> <packages> <package id=\"vk0\" price=\"100\" points=\"3\" /> <package id=\"vk1\" price=\"500\" points=\"20\" /> <package id=\"vk2\" price=\"1000\" points=\"45\" default=\"true\" /> <package id=\"vk3\" price=\"2500\" points=\"130\" /> <package id=\"vk4\" price=\"5000\" points=\"290\" /> </packages> </platform> </application> </configuration>", {Element, _} = xmerl_scan:string(XmlData), Rules = {configuration, [], @@ -62,7 +64,7 @@ XmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> beenzaxml:process_xml(Element, Rules). </code></pre> Will return easy-to-use deep proplist: <pre><code class="erlang"> [{application, @@ -84,7 +86,8 @@ XmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> [{points,290},{price,5000},{id,vk4}]}]}]}]}] </code></pre> ## LICENSE MIT license -
Mark Allen revised this gist
Mar 7, 2012 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ # Example xml <pre><code class="xml"> <?xml version="1.0" encoding="UTF-8" ?> <configuration> <application id="test"> @@ -16,8 +17,10 @@ </platform> </application> </configuration> </pre></code> # Usage example <pre><code class="erlang"> -module(t). -export([test/0]). @@ -57,9 +60,11 @@ XmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> }] }, beenzaxml:process_xml(Element, Rules). </code></pre> # Will return easy-to-use deep proplist: <pre><code class="erlang"> [{application, [{id,test}, {platform, @@ -78,6 +83,7 @@ XmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> {package, [{points,290},{price,5000},{id,vk4}]}]}]}]}] </code></pre> # LICENSE MIT license -
Mark Allen revised this gist
Mar 7, 2012 . 3 changed files with 110 additions and 68 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,59 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,91 @@ # Example xml <?xml version="1.0" encoding="UTF-8" ?> <configuration> <application id="test"> <platform id="vk"> <appId>123</appId> <secretKey>secret</secretKey> <packages> <package id="vk0" price="100" points="3" /> <package id="vk1" price="500" points="20" /> <package id="vk2" price="1000" points="45" default="true" /> <package id="vk3" price="2500" points="130" /> <package id="vk4" price="5000" points="290" /> </packages> </platform> </application> </configuration> # Usage example -module(t). -export([test/0]). test() -> XmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <configuration> <application id=\"test\"> <platform id=\"vk\"> <appId>123</appId> <secretKey>secret</secretKey> <packages> <package id=\"vk0\" price=\"100\" points=\"3\" /> <package id=\"vk1\" price=\"500\" points=\"20\" /> <package id=\"vk2\" price=\"1000\" points=\"45\" default=\"true\" /> <package id=\"vk3\" price=\"2500\" points=\"130\" /> <package id=\"vk4\" price=\"5000\" points=\"290\" /> </packages> </platform> </application> </configuration>", {Element, _} = xmerl_scan:string(XmlData), Rules = {configuration, [], [{application, [{id, to_atom}], [{platform, [{id, to_atom}], [ {appId, [], to_binary}, {secretKey, [], to_binary}, {packages, [], [ {package, [{id, to_atom}, {price, to_integer}, {points, to_integer}, {default, to_atom}], []} ]} ] }] }] }, beenzaxml:process_xml(Element, Rules). # Will return easy-to-use deep proplist: [{application, [{id,test}, {platform, [{id,vk}, {appId,[{value,<<"123">>}]}, {secretKey,[{value,<<"secret">>}]}, {packages, [{package,[{points,3},{price,100},{id,vk0}]}, {package,[{points,20},{price,500},{id,vk1}]}, {package, [{default,true}, {points,45}, {price,1000}, {id,vk2}]}, {package,[{points,130},{price,2500},{id,vk3}]}, {package, [{points,290},{price,5000},{id,vk4}]}]}]}]}] # LICENSE MIT license Copyright (c) 2012 Mark Allen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,21 @@ %% Convert XML to a deep proplist %% %% Original code by @wackum %% %% Modified code to return both attributes and values %% %% Copyright (C) 2012, Mark Allen %% All rights reserved. %% %% You may use this code under the MIT license as described in the README. -module(beenzaxml). -export([process_xml/2]). -include_lib("xmerl/include/xmerl.hrl"). process_attributes(#xmlElement{attributes=Attributes}, Rules) -> {_, AR, _} = Rules, lists:foldl(fun (Attr, Acc) -> process_attribute(Attr, Acc, AR) end, [], Attributes). process_attribute(#xmlAttribute{} = Attribute, State, Rules) -> Name = Attribute#xmlAttribute.name, @@ -18,20 +29,19 @@ process_value(Value, to_integer) -> list_to_integer(Value); process_value(Value, to_binary) -> list_to_binary(Value); process_value(Value, _) -> Value. element_text_content(#xmlElement{}=Element) -> Content = Element#xmlElement.content, ContentHead = hd(Content), ContentHead#xmlText.value. process_xml(Element, Rules) -> process_xml(Element, Rules, []). process_xml(#xmlElement{name=TagName} = Element, {TagName, _AttributesRules, ChildrenRules}, State) when is_list(ChildrenRules) -> [{ElTag, process_attributes(El, Rule) ++ process_xml(El, Rule, State)} || #xmlElement{name=ElTag} = El <- Element#xmlElement.content, {RuleTag, _, _}=Rule <- ChildrenRules, RuleTag==ElTag ] ++ State; process_xml(#xmlElement{} = Element, Rule, _State) -> {_, _, CR} = Rule, [{value, process_value(element_text_content(Element), CR)}]; process_xml(_, _, State) -> State. -
Nikita Kabardin renamed this gist
May 3, 2011 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Nikita Kabardin revised this gist
May 3, 2011 . 2 changed files with 59 additions and 59 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,59 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,59 @@ # Example xml <?xml version="1.0" encoding="UTF-8" ?> <configuration> <application id="test"> <platform id="vk"> <appId>123</appId> <secretKey>secret</secretKey> <packages> <package id="vk0" price="100" points="3" /> <package id="vk1" price="500" points="20" /> <package id="vk2" price="1000" points="45" default="true" /> <package id="vk3" price="2500" points="130" /> <package id="vk4" price="5000" points="290" /> </packages> </platform> </application> </configuration> # Usage example {Element, _} = xmerl_scan:string(binary_to_list(XmlData)), Rules = {configuration, [], [{application, [{id, to_atom}], [{platform, [{id, to_atom}], [ {appId, [], to_binary}, {secretKey, [], to_binary}, {packages, [], [ {package, [{id, to_atom}, {price, to_integer}, {points, to_integer}, {default, to_atom}], []} ]} ] }] }] }, beenzaxml:process_xml(Element, Rules). # Will return easy-to-use deep proplist: [{application, [{platform, [{appId,<<"123">>}, {secretKey,<<"secret">>}, {packages, [{package,[{points,3},{price,100},{id,vk0}]}, {package,[{points,20},{price,500},{id,vk1}]}, {package, [{default,true}, {points,45}, {price,1000}, {id,vk2}]}, {package,[{points,130},{price,2500},{id,vk3}]}, {package,[{points,290},{price,5000},{id,vk4}]}]}, {id,vk}]}, {id,test}]}] -
Nikita Kabardin created this gist
May 3, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ -module(beenzaxml). -export([process_xml/2]). -include_lib("xmerl/include/xmerl.hrl"). process_attributes(#xmlElement{attributes=Attributes}, Rules) -> lists:foldl(fun (Attr, Acc) -> process_attribute(Attr, Acc, Rules) end, [], Attributes). process_attribute(#xmlAttribute{} = Attribute, State, Rules) -> Name = Attribute#xmlAttribute.name, Value = Attribute#xmlAttribute.value, ProcessedValue = process_value(Value, proplists:get_value(Name, Rules)), [{Name, ProcessedValue}|State]. process_value(Value, Fun) when is_function(Fun ,1) -> Fun(Value); process_value(Value, to_atom) -> list_to_atom(Value); process_value(Value, to_integer) -> list_to_integer(Value); process_value(Value, to_binary) -> list_to_binary(Value); process_value(Value, _) -> Value. element_text_content(#xmlElement{}=Element) -> Content = Element#xmlElement.content, ContentHead = hd(Content), RawValue = ContentHead#xmlText.value, iolist_to_binary(RawValue). process_xml(Element, Rules) -> process_xml(Element, Rules, []). process_xml(#xmlElement{name=TagName} = Element, {TagName, AttributesRules, ChildrenRules}, State) when is_list(ChildrenRules) -> [{ElTag, process_xml(El, Rule, State)} || #xmlElement{name=ElTag} = El <- Element#xmlElement.content, {RuleTag, _, _}=Rule <- ChildrenRules, RuleTag==ElTag ] ++ process_attributes(Element, AttributesRules) ++ State; process_xml(#xmlElement{} = Element, Rule, _State) -> process_value(element_text_content(Element), Rule); process_xml(_, _, State) -> State. This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,59 @@ # Example xml > <?xml version="1.0" encoding="UTF-8" ?> > <configuration> > <application id="test"> > <platform id="vk"> > <appId>123</appId> > <secretKey>secret</secretKey> > <packages> > <package id="vk0" price="100" points="3" /> > <package id="vk1" price="500" points="20" /> > <package id="vk2" price="1000" points="45" default="true" /> > <package id="vk3" price="2500" points="130" /> > <package id="vk4" price="5000" points="290" /> > </packages> > </platform> > </application> ></configuration> # Usage example > {Element, _} = xmerl_scan:string(binary_to_list(XmlData)), > Rules = {configuration, [], > [{application, [{id, to_atom}], > [{platform, [{id, to_atom}], > [ > {appId, [], to_binary}, > {secretKey, [], to_binary}, > {packages, [], [ > {package, [{id, to_atom}, > {price, to_integer}, > {points, to_integer}, > {default, to_atom}], []} > ]} > ] > }] > }] > }, > beenzaxml:process_xml(Element, Rules). # Will return easy-to-use deep proplist: > [{application, > [{platform, > [{appId,<<"123">>}, > {secretKey,<<"secret">>}, > {packages, > [{package,[{points,3},{price,100},{id,vk0}]}, > {package,[{points,20},{price,500},{id,vk1}]}, > {package, > [{default,true}, > {points,45}, > {price,1000}, > {id,vk2}]}, > {package,[{points,130},{price,2500},{id,vk3}]}, > {package,[{points,290},{price,5000},{id,vk4}]}]}, > {id,vk}]}, > {id,test}]}]