mochiweb 、mochijson
来源:互联网 发布:工期进度计划软件 编辑:程序博客网 时间:2024/04/27 23:43
它的实现在mochiweb_request模块.在mochiweb中,每个client请求其构造一个 Req 对象(注:这个“对象“只是便于理解的提法), Req 可以理解成 mochiweb_request 的一个参数化或实例化.
http://www.360doc.com/content/12/1003/15/10834595_239290379.shtml
http://blog.csdn.net/dp0304/article/details/6994435
mochijson2 :The mochijson2 API essentially consists of just two functions, which (if you've downloaded mochiweb) can be used directly from the Erlang shell as follows:
erl -pa path/to/mochiweb/ebin...1> mochijson2:decode(<<"[1,2,3]">>).[1,2,3]2> iolist_to_binary(mochijson2:encode([1,2,3])).<<"[1,2,3]">>
ERL :: {struct, [{strKey, <<"strVal">>}, {intKey, 10}, {arrayKey, [1, 2, 3]}]}JSON :: {strKey:"strVal", intKey:10, arrayKey:[1, 2, 3]}
http://stackoverflow.com/questions/1000046/mochijson2-examples
部分说明
%% @author Bob Ippolito <bob@mochimedia.com>
%% @copyright 2007 Mochi Media, Inc.
%% @doc Yet another JSON (RFC 4627) library for Erlang. mochijson2 works
%% with binaries as strings, arrays as lists (without an {array, _})
%% wrapper and it only knows how to decode UTF-8 (and ASCII).
%%
%% JSON terms are decoded as follows (javascript -> erlang):
%% <ul>
%% <li>{"key": "value"} ->
%% {struct, [{<<"key">>, <<"value">>}]}</li>
%% <li>["array", 123, 12.34, true, false, null] ->
%% [<<"array">>, 123, 12.34, true, false, null]
%% </li>
%% </ul>
%% <ul>
%% <li>Strings in JSON decode to UTF-8 binaries in Erlang</li>
%% <li>Objects decode to {struct, PropList}</li>
%% <li>Numbers decode to integer or float</li>
%% <li>true, false, null decode to their respective terms.</li>
%% </ul>
%% The encoder will accept the same format that the decoder will produce,
%% but will also allow additional cases for leniency:
%% <ul>
%% <li>atoms other than true, false, null will be considered UTF-8
%% strings (even as a proplist key)
%% </li>
%% <li>{json, IoList} will insert IoList directly into the output
%% with no validation
%% </li>
%% <li>{array, Array} will be encoded as Array
%% (legacy mochijson style)
%% </li>
%% <li>A non-empty raw proplist will be encoded as an object as long
%% as the first pair does not have an atom key of json, struct,
%% or array
%% </li>
%% </ul>
- mochiweb 、mochijson
- 说说Mochiweb
- 实战 MochiWeb
- mochiweb 初探
- 再说mochiweb
- MochiWeb 开发心得
- 构建自动化mochiweb-nitrogen
- mochiweb源码 学习
- Erlang学习:MochiWeb + EMySQL
- Erlang学习:MochiWeb + ERedis
- mochiweb 获得各种参数
- MochiWeb 基本教程
- mochiweb 的使用
- Erlang并发编程(四) --- mochiweb
- mochiweb小结(基本流程)
- mochiweb学习--创建工程调试
- A practical introduction to MochiWeb
- mochiweb 如何处理http请求
- IOS支付宝集成
- 1024
- 进程的同步和异步
- 123
- 解决Desktop桌面版本命令连接wifi问题
- mochiweb 、mochijson
- 超简单实现Android自定义Toast(附源码)
- 微信开发学习总结(三)——开发微信公众号的最基本功能——普通消息的接收和回复
- ASMX WCF 比较
- Oracle学习
- 机会与挑战
- Android Studio常用快捷键设置和安装时的问题
- recyclerview下拉自动刷新
- 基于cherrypy利用form表单上传一张图片的方法介绍