Article directory:JavaScript Objects and PHP arrays
PHP array parsed into JSON format string$arr=array( ' file ' == Array (' Open ', ' close '), ' help ' = =array(' About the procedure '); echo json_encode ($arr);Output {"\u6587\u4ef6": ["\u6253\u5f00", "\u5173\u95ed"], "\u5e2e\u52a9": ["\u5173\u4e8e\u672c\u7a0b\u5e8f"]}The {} In JS represents an object.JS [] represents an array.= = corresponds to:There are several ways to traverse
The json-lib package is used to convert the time and space values of xml to json into air brackets. json-libjson
The project database contains a lot of data with a value of []. The test reports a bug. After troubleshooting, it is caused by the use of the json-lib jar package
Examples on the official website
JSON-lib is a Java class package used to convert beans, maps, and XML into JSON and convert JSON back to bean and dynabean.: Http://json-lib.sourceforge.net/The third-party package is also required:Org. Apache. commons (version 3.2 or later)O
The first step: Get a JSON interface that can be obtained from a URL address
Step two: Take the JSON string through file_get_contents
Step three: Convert a JSON-formatted string (object) into an array,
Json_decode (
Json,tRue) number of arguments :
JSON string
See this topic is not most people are dismissive, indeed almost every Java program ape has written the JSON tool class, and many people have used json-lib.jar encapsulation of similar functions, but I use the regular to support the XML and JSON, reduce the introduction of the jar package. Basically meet the needs. Of c
Json-lib can convert a Java object into a JSON-formatted string or convert a Java object into an XML-formatted document, either converting a JSON string into a Java object or converting an XML string into a Java object.
First, preparatory work
1, the first to go to the offi
1.XStream Tool Description:This tool, the jar package for this tool, can help us to generate XML-formatted data such as JavaBean, set (LIST,SET,MAP), etc.Jar Package:Xstream-1.4.4.jar, this is the core package.Xpp3_min-1.1.4c.jar This is a must-depend packageAs long as importing these two jar packages into the build path, you can use the.2.json-lib Introduction:This jar can help us to generate
DefinedJSON (JavaScript Object Notation) is a lightweight data interchange format.JSON takes a completely language-independent text format, but also uses a similar idiom to the C language family (c, C + +, C #, Java, JavaScript, Perl, Python, etc.). These features make JSON an ideal data exchange language.Topics to be concerned with in JSON research1, the comparison between
Test.java: Packagecom.xml.Test;ImportJava.io.BufferedReader;ImportJava.io.File;ImportJava.io.FileInputStream;Importjava.io.IOException;ImportJava.io.InputStreamReader;ImportNet.sf.json.JSON;ImportNet.sf.json.JSONObject;ImportNet.sf.json.xml.XMLSerializer; Public classTest { Public Static voidMain (string[] args)throwsIOException {//read the XML file under SRCFile file=NewFile ("src" +file.separator+ "xj.xml"); //character Stream OutputBufferedReader r
JsonJSON (JavaScript Object Notation) is a lightweight data interchange format with good readability and easy-to-write features. Data exchange between different platforms is possible. JSON uses a very high compatibility, completely independent of the language text format, but also has a similar to the C language habits (including C, C + +, C #, Java, JavaScript, Perl, Python, etc.) the behavior of the system. These features make
1. Introduction to the definition
1.1 XML definition
The Extensible Markup Language (extensible Markup Language, XML), which is used to mark an electronic file with a structured markup language, can be used to mark data, define data types, and is a source language that allows users to define their own markup language. XML organizes data using the DTD (document
1. Introduction to the definition
(1). XML definition
The Extensible Markup Language (extensible Markup Language, XML), which is used to mark an electronic file with a structured markup language, can be used to mark data, define data types, and is a source language that allows users to define their own markup language. XML organizes data using the DTD (document
Interview encountered the topic, do not know how to answer the series1. JSON definition (JavaScript Object Notation)A lightweight Data Interchange Format with good readability and easy-to-write features. Data exchange between different platforms is possible. JSON uses a high-compatibility text format, and also has a similar behavior to the C language system.2. XML
1. Definition Introduction(1). XML definitionThe Extensible Markup Language (extensible Markup Language, XML), which is used to tag electronic files with a structured markup language that can be used to tag data, define data types, is a source language that allows users to define their own markup language. XML uses the DTD (document type definition) document type
When I went to the interview this time, my manager asked me the difference between xml and json. I didn't answer the question, so I came back and checked the relevant materials to write something: 1. definition (1 ). XML defines ExtensibleMarkupLanguage (XML), which is used to mark electronic files so that they have a
ObjectiveBefore reading this article, you can also go to the ASP. NET Web API 2 series navigation to view http://www.cnblogs.com/aehyok/p/3446289.htmlThis article describes the JSON and XML formatters in the ASP.In the ASP. NET Web API, the media type formatter (Media-type Formatter) is an object that can do the following:
Reading CLR (Common language Runtime) objects from the HTTP message body
JSON: the fat-free alternative to XML
JSON: rich and free XML alternatives
(I don't know if this title is translated, right)
The Extensible Markup Language (XML) is a text format derived from the Standard Generic Markup Language (SGML. Compared with SGML,
Currently, in the Web development field, the main data exchange formats are XML and JSON, so I believe that every web developer is familiar with XML. In contrast, JSON may be unfamiliar with some new developers, or you may have heard of it before, but you may not know much about the differences between
0. Off-TopicI believe that any programmer who works with the web, especially the front-end engineers, has no idea what it's all about when it encounters XML for the first time. And then to be arranged with JSON dating, is also confused.What, wrong? Well, at least, the above is my own experience. In the second project I participated in during my internship, I was asked to use an asynchronous request to fetch
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.