소스 검색

Added doc for json_emit()

Sergey Lyubka 11 년 전
부모
커밋
bb2c5bdac9
1개의 변경된 파일15개의 추가작업 그리고 0개의 파일을 삭제
  1. 15 0
      README.md

+ 15 - 0
README.md

@@ -132,6 +132,21 @@ function. Values for `null`, `true`, `false`, and characters
 `{`, `}`, `[`, `]`, `,`, `:` are printed by
 `json_emit_raw_str()` function.
 
+    int json_emit(char *buf, int buf_len, const char *format, ...);
+
+A convenience function that generates JSON string using formatted output.
+Characters allowed in `format` string:
+
+- `[`, `]`, `{`, `}`, `,`, `:`, `\r`, `\n`, `\t`, ` `: these characters
+would be appended to the output buffer as-is,
+- `i`: argument must be an `long` value, outputs number
+- `f`: argument must be a `double` value, outputs number
+- `s`: argument must be a `\0`-terminated `char *` value, outputs quoted string
+- `S`: argument must be a `\0`-terminated `char *` value, outputs unquoted string
+- `N`: outputs `null`
+- `T`: outputs `true`
+- `F`: outputs `false`
+
 ## Example: accessing configuration parameters
 
     #include "frozen.h"