Installation and use of Linux under Jansson

Source: Internet
Author: User

1. Installing Jansson

./configure

Make

Make install

2. Generate the Help document

Cd doc

Make HTML

Spinx-build not a command when compiling and installing doc

Execute the following statement to install Sphinx

Easy_install-u Sphinx

Generate _build Folder

Cd _build/html/

Start the Help document using Firefox browser

Firefox index.html

3. Programming

Include header files: #include <jansson.h>

Add library-ljansson When compiling the connection:

Gcc–o Source Source.c–ljansson

If the execution program appears: Error while loading shared Libraries:libjansson.so.4:cannot open Shared object file:no such file or directory

Libjansson.so.4 This library is not found when the following method to solve

Find out where Libjansson.so.4 is located

Whereis Libjansson

Display: Libjansson:/usr/local/lib/libjansson.a/usr/local/lib/libjansson.la/usr/local/lib/libjansson.so

Your libjansson.so is located at:/usr/local/lib/libjansson.so

Determine if there is a real

Cd/usr/local/lib

Ls

If there is an execution of the following statement, create a libjansson.so symbol to link to the/usr/lib directory

Ln-s/usr/local/lib/libjansson.so/usr/lib/libjansson.so.4

Reload Library

Ldconfig

{"Jsonstr": "{\" incid\ ": Null,\" srcip\ ": Null,\" desip\ ": Null,\" protocol\ ": Null,\" policyid\ ": Null,\" snapshoot\ ": Null,\ "filename\": Null,\ "filetype\": Null,\ "filepath\": Null,\ "domain\": null} "," Commandkey ":" 11100112 "}

json_t *json_string(const char *value)

Returns the data type of a JSON string, converted to a format that the library can recognize. The error returns null, which must be in UTF-8 format.

Return value:new Reference.

Returns a new JSON string, or NULL on error. value must is a valid UTF-8 encoded Unicode string.

json_t *json_string_nocheck(const char *value)

Same as json_string (), does not check the validity of value

Return value:new Reference.

Like json_string (), but doesn ' t check the value is valid UTF-8. The use of this function only if your is certain, this really was the case (e.g. you has already checked it by other means).

const char *json_string_value(const json_t *string)

Returns a string in JSON string, which is a C-language string.

Returns The associated value of string as a null terminated UTF-8 encoded string, or null if string< /c7> is a JSON string.

The retuned value is read-only and must are not being modified or freed by the user. It is valid as long as a string exists, i.e. as long as its reference count have not dropped to zero.

int json_string_set(const json_t *string, const char *value)

Sets the value of string, if value is an invalid UTF-8 value, the setting fails.

Sets the associated value of string to value. value must is a valid UTF-8 encoded Unicode string. Returns 0 on Success and-1 on error.

int Json_string_set_nocheck(const json_t *string, const char *value)

Same as Json_string_set (), but does not check if value is a valid UTF-8 type

Like Json_string_set (), but doesn ' t check the value is valid UTF-8. The use of this function only if your is certain, this really was the case (e.g. you has already checked it by other means).

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.