Use Shell scripts to convert MySQL table data to json format, mysqljson
The script is as follows:
#!/bin/bashmysql -s -phello test >1.log
The data in table t1 is as follows:
mysql> select * from t1;+------+-------+| id | name |+------+-------+| 1 | || 1 | NULL || 2 | hello |+------+-------+3 rows in set (0.00 sec)
The script execution result is as follows:
concat_ws(',',concat_ws(':','{"
Obtain URL parameters using regular expressions
1. method for obtaining a single parameter
// Obtain the function getquerystring (name) {var Reg = new Regexp ("(^ | )" + name + "= ([^ ] *) using the URL parameter. ( | $) "); var r = Window. location. search. substr (1 ). match (REG); If (R! = NULL) return Unescape (R [2]); Return "";}
2. method for obtaining all parameters (JSON)
// Wang defeng: Obtain URL parameters and
It's been a long time. Json_decode cannot convert JSON to an array after PHP Curl:
The data returned by Curl is in BOM format and needs to be converted;
Some return data directly:
Print_r (Json_decode ($data, true));
can be converted.
$url = "http://localhost/web_services.php";
$post _data = Array ("username" => "Bob", "Key" => "12345");
$ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, $url);
In work, JavaScript objects need to be converted into strings. Therefore, a method is written using the dojo widget to convert JavaScript objects into strings. The specific implementation is as follows:
Dojo. provide ("jsonobject");
Call the dojo widget written above to convert JS objects to strings, as shown below:
Note: The JSON. js file is the storage locati
Use Replace to convert the address bar:varUrl= ' https://www.baidu.com/s?ie=utf-8f=8rsv_bp=1rsv_idx=1tn=baiduwd=js%E6%AD%A3%E5%88 %99%e8%a1%a8%e8%be%be%e5%bc%8foq=js%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%20konggersv_pq= E63baa94000c303crsv_t=2200eomme0fgnsjlppijbdy2ww1cakuxvt8jce2bif1gxlj%2btzixfz%2batlersv_enter=1 inputt=294rsv_sug3=56rsv_sug1=15rsv_sug7=100rsv_sug2=0rsv_sug4=772rsv_sug=2 ‘;//parsing the simulated address bar//var url = locati
IOS JSON NSString Convert to NSDictionary, jsonnsstring
NSString * str = @ "{\" info \ ": {\" body \ ": \" this is the test code, which contains two pictures
If you did not see this article in wb145230 blog,Click to view Original Text.
Using system;using system.collections.generic;using system.text;using system.reflection;using System.Data;using System.collections;namespace aimscommon{//Convert JSON format helper class
3)11) indicates that the current node is a top-level node and is directly added to the children of the root user. To 3)Every time a subnode is found, it will be removed from nodelist.Exit) The program ends. The returned root node is the complete multi-tree root node. You can access the node through its Child set andUse the json method to convert the tree data format.
Public class TreeNodeHelper {///
The
]['Date'] Print 'Wind Direction:'+ weather['Data']['Forecast'][i]['Fengxiang'] Print 'Wind:'+ weather['Data']['Forecast'][i]['Fengli'] Print 'High Temperature:'+ weather['Data']['Forecast'][i][' High'] Print 'Low Temperature:'+ weather['Data']['Forecast'][i][' Low'] Print 'weather:'+ weather['Data']['Forecast'][i]['type'] Print('-'* 50) Else: Print 'The city you entered is wrong, or the city you entered is not included i
var string_a = Urlarr[1];var string = String_a.split (' '); var res = {};for (var i = 0;i Convert URL parameters to JSON format, then batch to URL address stitching parameters
$.fn.serializejson=function () { var serializeobj={}; var array=this.serializearray (); var str=this.serialize (); $ (array). each (function () { if (Serializeobj[this.name]) { if ($.isarray (Serializeobj[this.name])) { Serializeobj[this.name].push (This.value); } else{ serializeobj[this.name]=[serializeobj[this.name],this.value];
function Formatjson (msg) { var rep = "~"; var jsonstr = json.stringify (msg, NULL, REP) var str = ""; for (var i = 0; i } jsonstr = ""; for (var i = 0; i Convert objects to JSON-style HTML code
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.