Suche senden
Hochladen
Json in node.js
•
0 gefällt mir
•
1,330 views
Simon Su
Folgen
json是目前當紅的資料傳輸格式,以簡單著稱,讓我們來看看node.js中怎麼使用他!
Weniger lesen
Mehr lesen
Melden
Teilen
Melden
Teilen
1 von 11
Empfohlen
快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
Lorex L. Yang
Kubernetes Basic Operation
Kubernetes Basic Operation
Simon Su
Google IoT Core 初體驗
Google IoT Core 初體驗
Simon Su
JSDC 2017 - 使用google cloud 從雲到端,動手刻個IoT
JSDC 2017 - 使用google cloud 從雲到端,動手刻個IoT
Simon Su
GCPUG.TW meetup #28 - GKE上運作您的k8s服務
GCPUG.TW meetup #28 - GKE上運作您的k8s服務
Simon Su
Google Cloud Platform Special Training
Google Cloud Platform Special Training
Simon Su
GCE Windows Serial Console Usage Guide
GCE Windows Serial Console Usage Guide
Simon Su
GCPNext17' Extend 開始GCP了嗎?
GCPNext17' Extend 開始GCP了嗎?
Simon Su
Empfohlen
快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
Lorex L. Yang
Kubernetes Basic Operation
Kubernetes Basic Operation
Simon Su
Google IoT Core 初體驗
Google IoT Core 初體驗
Simon Su
JSDC 2017 - 使用google cloud 從雲到端,動手刻個IoT
JSDC 2017 - 使用google cloud 從雲到端,動手刻個IoT
Simon Su
GCPUG.TW meetup #28 - GKE上運作您的k8s服務
GCPUG.TW meetup #28 - GKE上運作您的k8s服務
Simon Su
Google Cloud Platform Special Training
Google Cloud Platform Special Training
Simon Su
GCE Windows Serial Console Usage Guide
GCE Windows Serial Console Usage Guide
Simon Su
GCPNext17' Extend 開始GCP了嗎?
GCPNext17' Extend 開始GCP了嗎?
Simon Su
Try Cloud Spanner
Try Cloud Spanner
Simon Su
Google Cloud Monitoring
Google Cloud Monitoring
Simon Su
Google Cloud Computing compares GCE, GAE and GKE
Google Cloud Computing compares GCE, GAE and GKE
Simon Su
JCConf 2016 - Google Dataflow 小試
JCConf 2016 - Google Dataflow 小試
Simon Su
JCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop Labs
Simon Su
JCConf2016 - Dataflow Workshop Setup
JCConf2016 - Dataflow Workshop Setup
Simon Su
GCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow Introduction
Simon Su
Brocade - Stingray Application Firewall
Brocade - Stingray Application Firewall
Simon Su
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
Simon Su
Docker in Action
Docker in Action
Simon Su
Google I/O 2016 Recap - Google Cloud Platform News Update
Google I/O 2016 Recap - Google Cloud Platform News Update
Simon Su
IThome DevOps Summit - IoT、docker與DevOps
IThome DevOps Summit - IoT、docker與DevOps
Simon Su
Google Cloud Platform Introduction - 2016Q3
Google Cloud Platform Introduction - 2016Q3
Simon Su
Google I/O Extended 2016 - 台北場活動回顧
Google I/O Extended 2016 - 台北場活動回顧
Simon Su
GCS - Access Control Lists (中文)
GCS - Access Control Lists (中文)
Simon Su
Google Cloud Platform - for Mobile Solutions
Google Cloud Platform - for Mobile Solutions
Simon Su
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
Simon Su
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(上)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(上)
Simon Su
GCPUG.TW - 2016活動討論
GCPUG.TW - 2016活動討論
Simon Su
GCPUG.TW - 2015活動回顧
GCPUG.TW - 2015活動回顧
Simon Su
Weitere ähnliche Inhalte
Mehr von Simon Su
Try Cloud Spanner
Try Cloud Spanner
Simon Su
Google Cloud Monitoring
Google Cloud Monitoring
Simon Su
Google Cloud Computing compares GCE, GAE and GKE
Google Cloud Computing compares GCE, GAE and GKE
Simon Su
JCConf 2016 - Google Dataflow 小試
JCConf 2016 - Google Dataflow 小試
Simon Su
JCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop Labs
Simon Su
JCConf2016 - Dataflow Workshop Setup
JCConf2016 - Dataflow Workshop Setup
Simon Su
GCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow Introduction
Simon Su
Brocade - Stingray Application Firewall
Brocade - Stingray Application Firewall
Simon Su
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
Simon Su
Docker in Action
Docker in Action
Simon Su
Google I/O 2016 Recap - Google Cloud Platform News Update
Google I/O 2016 Recap - Google Cloud Platform News Update
Simon Su
IThome DevOps Summit - IoT、docker與DevOps
IThome DevOps Summit - IoT、docker與DevOps
Simon Su
Google Cloud Platform Introduction - 2016Q3
Google Cloud Platform Introduction - 2016Q3
Simon Su
Google I/O Extended 2016 - 台北場活動回顧
Google I/O Extended 2016 - 台北場活動回顧
Simon Su
GCS - Access Control Lists (中文)
GCS - Access Control Lists (中文)
Simon Su
Google Cloud Platform - for Mobile Solutions
Google Cloud Platform - for Mobile Solutions
Simon Su
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
Simon Su
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(上)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(上)
Simon Su
GCPUG.TW - 2016活動討論
GCPUG.TW - 2016活動討論
Simon Su
GCPUG.TW - 2015活動回顧
GCPUG.TW - 2015活動回顧
Simon Su
Mehr von Simon Su
(20)
Try Cloud Spanner
Try Cloud Spanner
Google Cloud Monitoring
Google Cloud Monitoring
Google Cloud Computing compares GCE, GAE and GKE
Google Cloud Computing compares GCE, GAE and GKE
JCConf 2016 - Google Dataflow 小試
JCConf 2016 - Google Dataflow 小試
JCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop Labs
JCConf2016 - Dataflow Workshop Setup
JCConf2016 - Dataflow Workshop Setup
GCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow Introduction
Brocade - Stingray Application Firewall
Brocade - Stingray Application Firewall
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
Docker in Action
Docker in Action
Google I/O 2016 Recap - Google Cloud Platform News Update
Google I/O 2016 Recap - Google Cloud Platform News Update
IThome DevOps Summit - IoT、docker與DevOps
IThome DevOps Summit - IoT、docker與DevOps
Google Cloud Platform Introduction - 2016Q3
Google Cloud Platform Introduction - 2016Q3
Google I/O Extended 2016 - 台北場活動回顧
Google I/O Extended 2016 - 台北場活動回顧
GCS - Access Control Lists (中文)
GCS - Access Control Lists (中文)
Google Cloud Platform - for Mobile Solutions
Google Cloud Platform - for Mobile Solutions
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(下)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(上)
JCConf 2015 - 輕鬆學google的雲端開發 - Google App Engine入門(上)
GCPUG.TW - 2016活動討論
GCPUG.TW - 2016活動討論
GCPUG.TW - 2015活動回顧
GCPUG.TW - 2015活動回顧
Json in node.js
1.
JSON in Node.js Simon
Su
2.
What is JSON ●
JSON全名為JavaScript Object Notation ● 其原意是要使用純文字的方式來取代物件導 向中的物件
3.
JSON物件模型 - Object 上面圖像表示JSON物件為使用"{"與"}"組成的文字,左右大括 弧中間則是包含一個以上的"string:value",我們稱為key-value pair,其中key必須為string格式,而value則可以為原生型別或 是JSON物件(形成階層式的JSON物件)。
4.
JSON物件模型 - Array 上面圖像表示JSON陣列為"["與"]"所組成的一串文字,左右中 括弧間則是包含一個以上的value,此value可以試原生型別或 是JSON物件甚至是JSON陣列。
5.
JavaScript中的JSON操作 新增一個空的JSON物件可以這樣做: var json =
{}; 而當需要在其中增加屬性與其對應的值,可以: var json = { "key" : "value" };
6.
JSON物件的操作 - 動態增刪field 繼承JS弱型別的特性,JSON物件是一個可以動 態增長的物件,並且可以透過簡單的方式直接操 作: 1.
新增加物件屬性: var json = {}; json.key = 'value'; 2. 刪除物件屬性: delete json.key;
7.
JSON物件的操作 - field給值方式 針對JSON物件,操縱JSON物件的屬性有兩種方 式: 1.
使用[物件實體].[參數名稱]: var json = {}; json.key = 'value'; 2. 使用陣列的操作方式: var json = {}; json['key'] = 'value';
8.
JSON物件的操作 - function節點 繼承JS的特性,function可以賦予在一個變數上, 因此JSON中您也可以將function指定給某個屬 性(我通常把它稱為節點/node)... var
dbo = { create : function(){ //do the create } } //同等於:dbo.create() dbo['create']();
9.
不可不知工具 - underscore.js underscore.js是一套優質的工具模組,在node.js 的專案中,可以透過npm做安裝: #
npm install underscore 該套件主要提供常用的Collection, Array, Function, Object...的操作,而且可以是用於前端 js,熟悉他的話,開發工作可以事半功倍喔!
10.
不可不知工具 - underscore.js var
_ = require('underscore'); var arr = [ {"aaa": [1,2,3]}, {"bbb": {a: 111, b: 222}} ]; console.log('Before...'); console.log(arr); arr = _.reject(arr, function(v){ if(v.aaa) return true; return false; }); console.log('After...'); console.log(arr); 執行結果:
11.
Reference ● Opennodes: http://opennodes.github.io ● JSON: http://json.org/ ●
underscore.js: http://underscorejs.org