{"id":77305,"date":"2024-08-29T17:09:05","date_gmt":"2024-08-29T10:09:05","guid":{"rendered":"https:\/\/itviec.com\/blog\/?p=77305"},"modified":"2024-08-29T17:09:05","modified_gmt":"2024-08-29T10:09:05","slug":"json-python-co-ban","status":"publish","type":"post","link":"https:\/\/itviec.com\/blog\/json-python-co-ban\/","title":{"rendered":"JSON Python ph\u1ea7n 1: Thao t\u00e1c JSON c\u01a1 b\u1ea3n v\u1edbi Python"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed9i dung b\u00e0i vi\u1ebft<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itviec.com\/blog\/json-python-co-ban\/#Gioi_thieu_chuoi_bai_viet_JSON_Python\" >Gi\u1edbi thi\u1ec7u chu\u1ed7i b\u00e0i vi\u1ebft JSON Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itviec.com\/blog\/json-python-co-ban\/#JSON_la_gi\" >JSON l\u00e0 g\u00ec?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itviec.com\/blog\/json-python-co-ban\/#Python_la_gi\" >Python l\u00e0 g\u00ec?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itviec.com\/blog\/json-python-co-ban\/#Cac_thao_tac_don_gian_voi_JSON_trong_Python\" >C\u00e1c thao t\u00e1c \u0111\u01a1n gi\u1ea3n v\u1edbi JSON trong Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itviec.com\/blog\/json-python-co-ban\/#Luu_tru_JSON\" >L\u01b0u tr\u1eef JSON<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/itviec.com\/blog\/json-python-co-ban\/#Cong_cu_dinh_dang_JSON\" >C\u00f4ng c\u1ee5 \u0111\u1ecbnh d\u1ea1ng JSON<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/itviec.com\/blog\/json-python-co-ban\/#Cau_hoi_thuong_gap_ve_JSON_Python\" >C\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 JSON Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/itviec.com\/blog\/json-python-co-ban\/#Tong_ket_JSON_Python_phan_1\" >T\u1ed5ng k\u1ebft JSON Python ph\u1ea7n 1<\/a><\/li><\/ul><\/nav><\/div>\n<p><em><strong>JSON (JavaScript Object Notation) l\u00e0 m\u1ed9t \u0111\u1ecbnh d\u1ea1ng trao \u0111\u1ed5i d\u1eef li\u1ec7u si\u00eau nh\u1eb9 v\u00e0 d\u1ec5 \u0111\u1ecdc, ph\u00f9 h\u1ee3p cho c\u1ea3 con ng\u01b0\u1eddi l\u1eabn m\u00e1y m\u00f3c. Trong th\u1ebf gi\u1edbi l\u1eadp tr\u00ecnh v\u00e0 khoa h\u1ecdc d\u1eef li\u1ec7u, JSON \u0111\u01b0\u1ee3c \u01b0a chu\u1ed9ng \u0111\u1ec3 truy\u1ec1n t\u1ea3i d\u1eef li\u1ec7u gi\u1eefa m\u00e1y ch\u1ee7 v\u00e0 \u1ee9ng d\u1ee5ng web, c\u0169ng nh\u01b0 l\u01b0u tr\u1eef d\u1eef li\u1ec7u m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3. Python, ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh hot hit nh\u1ea5t hi\u1ec7n nay, c\u00f3 kh\u1ea3 n\u0103ng x\u1eed l\u00fd JSON c\u1ef1c k\u1ef3 d\u1ec5 d\u00e0ng v\u00e0 hi\u1ec7u qu\u1ea3. Trong b\u00e0i vi\u1ebft n\u00e0y, ch\u00fang ta s\u1ebd c\u00f9ng kh\u00e1m ph\u00e1 c\u00e1ch s\u1eed d\u1ee5ng Python \u0111\u1ec3 l\u00e0m vi\u1ec7c v\u1edbi JSON, t\u1eeb c\u00e1c thao t\u00e1c c\u01a1 b\u1ea3n \u0111\u1ebfn l\u01b0u tr\u1eef d\u1eef li\u1ec7u.<\/strong><\/em><\/p>\n<p><span style=\"font-weight: 400;\">B\u00e0i vi\u1ebft n\u00e0y d\u00e0nh cho nh\u1eefng l\u1eadp tr\u00ecnh vi\u00ean Python \u0111\u00e3 c\u00f3 ki\u1ebfn th\u1ee9c c\u0103n b\u1ea3n v\u00e0 nh\u1eefng ai \u0111ang s\u1eed d\u1ee5ng Python cho c\u00e1c c\u00f4ng vi\u1ec7c nh\u01b0 Data Engineering, Web Scraping, ho\u1eb7c ph\u00e1t tri\u1ec3n backend v\u1edbi c\u00e1c framework x\u1ecbn s\u00f2 nh\u01b0 Flask hay Django. H\u00e3y c\u00f9ng b\u1eaft \u0111\u1ea7u h\u00e0nh tr\u00ecnh kh\u00e1m ph\u00e1 JSON v\u1edbi Python n\u00e0o!<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Gioi_thieu_chuoi_bai_viet_JSON_Python\"><\/span><strong>Gi\u1edbi thi\u1ec7u chu\u1ed7i b\u00e0i vi\u1ebft JSON Python<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">\u0110\u00e2y l\u00e0 ph\u1ea7n \u0111\u1ea7u ti\u00ean c\u1ee7a chu\u1ed7i b\u00e0i vi\u1ebft g\u1ed3m hai ph\u1ea7n v\u1ec1 x\u1eed l\u00fd JSON v\u1edbi Python. Ph\u1ea7n 1 n\u00e0y s\u1ebd t\u1eadp trung v\u00e0o c\u00e1c thao t\u00e1c c\u01a1 b\u1ea3n v\u1edbi JSON trong Python, bao g\u1ed3m:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u0110\u1ecdc file JSON<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Vi\u1ebft d\u1eef li\u1ec7u v\u00e0o file JSON<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Chuy\u1ec3n \u0111\u1ed5i t\u1eeb Python sang JSON<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">L\u01b0u tr\u1eef JSON<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u00f4ng c\u1ee5 \u0111\u1ecbnh d\u1ea1ng JSON<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">B\u00e0i vi\u1ebft <a href=\"https:\/\/itviec.com\/blog\/ung-dung-json-trong-python\/\" target=\"_blank\" rel=\"noopener\"><strong>JSON Python ph\u1ea7n 2: \u1ee8ng d\u1ee5ng d\u00f9ng Python \u0111\u1ec3 x\u1eed l\u00fd JSON<\/strong><\/a>\u00a0s\u1ebd \u0111i v\u00e0o chi ti\u1ebft c\u00e1c \u1ee9ng d\u1ee5ng th\u1ef1c t\u1ebf c\u1ee7a Python trong vi\u1ec7c x\u1eed l\u00fd JSON, bao g\u1ed3m:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">L\u01b0u tr\u1eef trong c\u01a1 s\u1edf d\u1eef li\u1ec7u quan h\u1ec7 (RDBMS)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u1eadp nh\u1eadt n\u1ed9i dung web<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ghi log<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ph\u00e1t tri\u1ec3n API<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Web Scraping<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"JSON_la_gi\"><\/span><strong>JSON l\u00e0 g\u00ec?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">JSON l\u00e0 vi\u1ebft t\u1eaft c\u1ee7a &#8220;JavaScript Object Notation.&#8221; \u0110\u00e2y l\u00e0 \u0111\u1ecbnh d\u1ea1ng d\u1eef li\u1ec7u nh\u1eb9 v\u00e0 d\u1ec5 \u0111\u1ecdc, gi\u00fap \u0111\u01a1n gi\u1ea3n h\u00f3a vi\u1ec7c trao \u0111\u1ed5i d\u1eef li\u1ec7u gi\u1eefa c\u00e1c h\u1ec7 th\u1ed1ng.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">JSON \u0111\u01b0\u1ee3c ph\u00e1t tri\u1ec3n b\u1edfi Douglas Crockford v\u00e0o \u0111\u1ea7u nh\u1eefng n\u0103m 2000. M\u1eb7c d\u00f9 d\u1ef1a tr\u00ean c\u00fa ph\u00e1p c\u1ee7a JavaScript, JSON ho\u00e0n to\u00e0n \u0111\u1ed9c l\u1eadp v\u00e0 c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng v\u1edbi nhi\u1ec1u ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh kh\u00e1c nhau.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">V\u00ec sao v\u00e0 khi n\u00e0o n\u00ean d\u00f9ng Python \u0111\u1ec3 x\u1eed l\u00fd JSON thay v\u00ec JavaScript?<\/span><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Th\u01b0 vi\u1ec7n m\u1ea1nh m\u1ebd:<\/b><span style=\"font-weight: 400;\"> Python c\u00f3 th\u01b0 vi\u1ec7n <\/span><span style=\"font-weight: 400;\">json<\/span><span style=\"font-weight: 400;\"> t\u00edch h\u1ee3p s\u1eb5n, gi\u00fap \u0111\u1ecdc, ghi v\u00e0 x\u1eed l\u00fd JSON d\u1ec5 d\u00e0ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>C\u00fa ph\u00e1p \u0111\u01a1n gi\u1ea3n:<\/b><span style=\"font-weight: 400;\"> Python d\u1ec5 h\u1ecdc v\u00e0 tr\u1ef1c quan, gi\u00fap b\u1ea1n nhanh ch\u00f3ng x\u1eed l\u00fd d\u1eef li\u1ec7u m\u00e0 kh\u00f4ng g\u1eb7p nhi\u1ec1u kh\u00f3 kh\u0103n.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>X\u1eed l\u00fd d\u1eef li\u1ec7u l\u1edbn v\u00e0 ph\u1ee9c t\u1ea1p:<\/b><span style=\"font-weight: 400;\"> Python v\u1edbi Pandas gi\u00fap x\u1eed l\u00fd v\u00e0 ph\u00e2n t\u00edch d\u1eef li\u1ec7u JSON hi\u1ec7u qu\u1ea3 h\u01a1n.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Web scraping:<\/b><span style=\"font-weight: 400;\"> BeautifulSoup v\u00e0 Scrapy trong Python gi\u00fap thu th\u1eadp v\u00e0 ph\u00e2n t\u00edch d\u1eef li\u1ec7u t\u1eeb web d\u1ec5 d\u00e0ng.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">JSON s\u1eed d\u1ee5ng c\u1ea5u tr\u00fac v\u0103n b\u1ea3n v\u1edbi c\u00e1c c\u1eb7p kh\u00f3a-gi\u00e1 tr\u1ecb (key-value) v\u00e0 m\u1ea3ng (array). D\u01b0\u1edbi \u0111\u00e2y l\u00e0 m\u1ed9t v\u00ed d\u1ee5 v\u1ec1 c\u1ea5u tr\u00fac JSON:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \"name\": <\/span><span style=\"font-weight: 400;\">\"John\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \"age\": <\/span><span style=\"font-weight: 400;\">30<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \"city\": <\/span><span style=\"font-weight: 400;\">\"New York\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \"hasChildren\": <\/span><span style=\"font-weight: 400;\">false<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \"titles\": [<\/span><span style=\"font-weight: 400;\">\"engineer\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"programmer\"<\/span><span style=\"font-weight: 400;\">]<\/span>\r\n<span style=\"font-weight: 400;\">}\r\n<\/span><\/pre>\n<blockquote><p><em>\u0110\u1ecdc th\u00eam: <a href=\"https:\/\/itviec.com\/blog\/json-la-gi\/\" target=\"_blank\" rel=\"noopener\"><strong>JSON l\u00e0 g\u00ec? C\u00e1c lo\u1ea1i d\u1eef li\u1ec7u JSON l\u00e0 g\u00ec v\u00e0 \u00e1p d\u1ee5ng th\u1ebf n\u00e0o?<\/strong><\/a><\/em><\/p><\/blockquote>\n<h2><span class=\"ez-toc-section\" id=\"Python_la_gi\"><\/span><strong>Python l\u00e0 g\u00ec?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Python l\u00e0 m\u1ed9t ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh b\u1eadc cao, th\u00f4ng d\u1ecbch, v\u00e0 \u0111a n\u0103ng. \u0110\u01b0\u1ee3c \u01b0a chu\u1ed9ng nh\u1edd c\u00fa ph\u00e1p \u0111\u01a1n gi\u1ea3n v\u00e0 th\u01b0 vi\u1ec7n phong ph\u00fa, Python l\u00e0 l\u1ef1a ch\u1ecdn l\u00fd t\u01b0\u1edfng cho nhi\u1ec1u \u1ee9ng d\u1ee5ng kh\u00e1c nhau, t\u1eeb ph\u00e1t tri\u1ec3n web \u0111\u1ebfn khoa h\u1ecdc d\u1eef li\u1ec7u.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Python cung c\u1ea5p m\u1ed9t module t\u00edch h\u1ee3p s\u1eb5n t\u00ean l\u00e0 <\/span><span style=\"font-weight: 400;\">json<\/span><span style=\"font-weight: 400;\">, cho ph\u00e9p l\u1eadp tr\u00ecnh vi\u00ean d\u1ec5 d\u00e0ng chuy\u1ec3n \u0111\u1ed5i gi\u1eefa JSON v\u00e0 c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng Python. \u0110i\u1ec1u n\u00e0y gi\u00fap Python tr\u1edf th\u00e0nh m\u1ed9t c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd cho vi\u1ec7c x\u1eed l\u00fd d\u1eef li\u1ec7u JSON, h\u1ed7 tr\u1ee3 vi\u1ec7c ph\u00e2n t\u00edch, l\u01b0u tr\u1eef v\u00e0 truy\u1ec1n t\u1ea3i d\u1eef li\u1ec7u m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Cac_thao_tac_don_gian_voi_JSON_trong_Python\"><\/span><strong>C\u00e1c thao t\u00e1c \u0111\u01a1n gi\u1ea3n v\u1edbi JSON trong Python<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><strong>\u0110\u1ecdc file JSON<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 \u0111\u1ecdc m\u1ed9t file JSON trong Python, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng ph\u01b0\u01a1ng th\u1ee9c <\/span><span style=\"font-weight: 400;\">json.load()<\/span><span style=\"font-weight: 400;\">. D\u01b0\u1edbi \u0111\u00e2y l\u00e0 m\u1ed9t v\u00ed d\u1ee5:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import<\/span><span style=\"font-weight: 400;\"> json<\/span>\r\n\r\n<span style=\"font-weight: 400;\">with<\/span><span style=\"font-weight: 400;\"> open(<\/span><span style=\"font-weight: 400;\">'data.json'<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">'r'<\/span><span style=\"font-weight: 400;\">) <\/span><span style=\"font-weight: 400;\">as<\/span><span style=\"font-weight: 400;\"> file:<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 data = json.load(file)<\/span>\r\n\r\n<span style=\"font-weight: 400;\">print(data)<\/span><\/pre>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">import json<\/span><span style=\"font-weight: 400;\">: D\u00f2ng n\u00e0y nh\u1eadp th\u01b0 vi\u1ec7n json v\u00e0o ch\u01b0\u01a1ng tr\u00ecnh. Th\u01b0 vi\u1ec7n n\u00e0y cung c\u1ea5p c\u00e1c c\u00f4ng c\u1ee5 \u0111\u1ec3 l\u00e0m vi\u1ec7c v\u1edbi d\u1eef li\u1ec7u \u0111\u1ecbnh d\u1ea1ng JSON.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">with open(&#8216;data.json&#8217;, &#8216;r&#8217;) as file:<\/span><span style=\"font-weight: 400;\">: D\u00f2ng n\u00e0y m\u1edf m\u1ed9t t\u1ec7p c\u00f3 t\u00ean &#8216;data.json&#8217; trong ch\u1ebf \u0111\u1ed9 \u0111\u1ecdc (&#8216;r&#8217;). T\u1eeb kh\u00f3a <\/span><span style=\"font-weight: 400;\">with<\/span><span style=\"font-weight: 400;\"> \u0111\u1ea3m b\u1ea3o t\u1ec7p s\u1ebd \u0111\u01b0\u1ee3c \u0111\u00f3ng \u0111\u00fang c\u00e1ch sau khi s\u1eed d\u1ee5ng xong.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">data = json.load(file)<\/span><span style=\"font-weight: 400;\">: D\u00f2ng n\u00e0y \u0111\u1ecdc n\u1ed9i dung c\u1ee7a t\u1ec7p JSON v\u00e0 chuy\u1ec3n \u0111\u1ed5i n\u00f3 th\u00e0nh m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng Python (th\u01b0\u1eddng l\u00e0 m\u1ed9t t\u1eeb \u0111i\u1ec3n ho\u1eb7c danh s\u00e1ch). K\u1ebft qu\u1ea3 \u0111\u01b0\u1ee3c l\u01b0u v\u00e0o bi\u1ebfn <\/span><span style=\"font-weight: 400;\">data<\/span><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">print(data)<\/span><span style=\"font-weight: 400;\">: D\u00f2ng n\u00e0y in ra n\u1ed9i dung c\u1ee7a bi\u1ebfn <\/span><span style=\"font-weight: 400;\">data<\/span><span style=\"font-weight: 400;\">, hi\u1ec3n th\u1ecb d\u1eef li\u1ec7u \u0111\u00e3 \u0111\u01b0\u1ee3c \u0111\u1ecdc t\u1eeb t\u1ec7p JSON.<\/span><\/li>\n<\/ul>\n<h3><strong>Vi\u1ebft d\u1eef li\u1ec7u v\u00e0o file JSON<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 ghi d\u1eef li\u1ec7u v\u00e0o file JSON, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng ph\u01b0\u01a1ng th\u1ee9c <\/span><span style=\"font-weight: 400;\">json.dump()<\/span><span style=\"font-weight: 400;\">. V\u00ed d\u1ee5:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import<\/span><span style=\"font-weight: 400;\"> json<\/span>\r\n\r\n<span style=\"font-weight: 400;\">data = {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">\"name\"<\/span><span style=\"font-weight: 400;\">: <\/span><span style=\"font-weight: 400;\">\"John\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">\"age\"<\/span><span style=\"font-weight: 400;\">: <\/span><span style=\"font-weight: 400;\">30<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">\"city\"<\/span><span style=\"font-weight: 400;\">: <\/span><span style=\"font-weight: 400;\">\"New York\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n\r\n<span style=\"font-weight: 400;\">with<\/span><span style=\"font-weight: 400;\"> open(<\/span><span style=\"font-weight: 400;\">'data.json'<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">'w'<\/span><span style=\"font-weight: 400;\">) <\/span><span style=\"font-weight: 400;\">as<\/span><span style=\"font-weight: 400;\"> file:<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 json.dump(data, file, indent=<\/span><span style=\"font-weight: 400;\">4<\/span><span style=\"font-weight: 400;\">)<\/span><\/pre>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">import json<\/span><span style=\"font-weight: 400;\">: D\u00f2ng n\u00e0y nh\u1eadp th\u01b0 vi\u1ec7n json v\u00e0o ch\u01b0\u01a1ng tr\u00ecnh, cung c\u1ea5p c\u00e1c c\u00f4ng c\u1ee5 \u0111\u1ec3 l\u00e0m vi\u1ec7c v\u1edbi d\u1eef li\u1ec7u JSON.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">data = {&#8230;}<\/span><span style=\"font-weight: 400;\">: \u0110\u00e2y l\u00e0 m\u1ed9t t\u1eeb \u0111i\u1ec3n Python ch\u1ee9a d\u1eef li\u1ec7u m\u00e0 ch\u00fang ta mu\u1ed1n l\u01b0u v\u00e0o t\u1ec7p JSON. N\u00f3 bao g\u1ed3m ba c\u1eb7p kh\u00f3a-gi\u00e1 tr\u1ecb: t\u00ean, tu\u1ed5i v\u00e0 th\u00e0nh ph\u1ed1.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">with open(&#8216;data.json&#8217;, &#8216;w&#8217;) as file:<\/span><span style=\"font-weight: 400;\">: D\u00f2ng n\u00e0y m\u1edf (ho\u1eb7c t\u1ea1o m\u1edbi n\u1ebfu ch\u01b0a t\u1ed3n t\u1ea1i) m\u1ed9t t\u1ec7p c\u00f3 t\u00ean &#8216;data.json&#8217; trong ch\u1ebf \u0111\u1ed9 ghi (&#8216;w&#8217;). T\u1eeb kh\u00f3a <\/span><span style=\"font-weight: 400;\">with<\/span><span style=\"font-weight: 400;\"> \u0111\u1ea3m b\u1ea3o t\u1ec7p s\u1ebd \u0111\u01b0\u1ee3c \u0111\u00f3ng \u0111\u00fang c\u00e1ch sau khi s\u1eed d\u1ee5ng xong.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">json.dump(data, file, indent=4)<\/span><span style=\"font-weight: 400;\">: \u0110\u00e2y l\u00e0 h\u00e0m ch\u00ednh \u0111\u1ec3 ghi d\u1eef li\u1ec7u v\u00e0o t\u1ec7p JSON:<\/span>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">data<\/span><span style=\"font-weight: 400;\"> l\u00e0 t\u1eeb \u0111i\u1ec3n Python ch\u00fang ta mu\u1ed1n chuy\u1ec3n \u0111\u1ed5i th\u00e0nh JSON.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">file<\/span><span style=\"font-weight: 400;\"> l\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng t\u1ec7p m\u00e0 ch\u00fang ta \u0111ang ghi v\u00e0o.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">indent=4<\/span><span style=\"font-weight: 400;\"> l\u00e0 m\u1ed9t tham s\u1ed1 t\u00f9y ch\u1ecdn, ch\u1ec9 \u0111\u1ecbnh r\u1eb1ng JSON n\u00ean \u0111\u01b0\u1ee3c \u0111\u1ecbnh d\u1ea1ng v\u1edbi th\u1ee5t l\u1ec1 4 kho\u1ea3ng tr\u1eafng, gi\u00fap t\u1ec7p d\u1ec5 \u0111\u1ecdc h\u01a1n.<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3><strong>Chuy\u1ec3n \u0111\u1ed5i t\u1eeb Python sang JSON<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Chuy\u1ec3n \u0111\u1ed5i JSON th\u00e0nh d\u1ea1ng b\u1ea3ng l\u00e0 m\u1ed9t trong nh\u1eefng nhi\u1ec7m v\u1ee5 quan tr\u1ecdng c\u1ee7a Data Engineer v\u00e0 Data Analyst. C\u00f4ng vi\u1ec7c n\u00e0y gi\u00fap c\u00e1c team ph\u00e2n t\u00edch d\u1eef li\u1ec7u c\u00f3 th\u1ec3 truy v\u1ea5n v\u00e0 t\u00ecm hi\u1ec3u s\u00e2u h\u01a1n v\u1ec1 h\u00e0nh vi s\u1eed d\u1ee5ng c\u1ee7a ng\u01b0\u1eddi d\u00f9ng tr\u00ean web. D\u1eef li\u1ec7u n\u00e0y c\u00f3 th\u1ec3 bao g\u1ed3m c\u00e1c s\u1ef1 ki\u1ec7n ng\u01b0\u1eddi d\u00f9ng, t\u01b0\u01a1ng t\u00e1c tr\u00ean website, ho\u1eb7c th\u00f4ng tin kh\u00e1ch h\u00e0ng.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Data Engineer v\u00e0 Data Analyst th\u01b0\u1eddng vi\u1ebft c\u00e1c script Python \u0111\u1ec3 chuy\u1ec3n \u0111\u1ed5i d\u1eef li\u1ec7u JSON th\u00e0nh c\u00e1c b\u1ea3ng quan h\u1ec7, n\u01a1i m\u00e0 vi\u1ec7c l\u01b0u tr\u1eef tr\u1ef1c ti\u1ebfp JSON kh\u00f4ng \u0111\u01b0\u1ee3c h\u1ed7 tr\u1ee3 ho\u1eb7c kh\u00f4ng c\u1ea7n thi\u1ebft.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">D\u01b0\u1edbi \u0111\u00e2y l\u00e0 b\u1ea3ng chuy\u1ec3n \u0111\u1ed5i t\u01b0\u01a1ng \u1ee9ng gi\u1eefa c\u00e1c ki\u1ec3u d\u1eef li\u1ec7u trong Python v\u00e0 JSON:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Python Object<\/b><\/td>\n<td><b>JSON Object<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">dict<\/span><\/td>\n<td><span style=\"font-weight: 400;\">object<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">list, tuple<\/span><\/td>\n<td><span style=\"font-weight: 400;\">array<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">str<\/span><\/td>\n<td><span style=\"font-weight: 400;\">string<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">int, float<\/span><\/td>\n<td><span style=\"font-weight: 400;\">number<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">True<\/span><\/td>\n<td><span style=\"font-weight: 400;\">true<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">False<\/span><\/td>\n<td><span style=\"font-weight: 400;\">false<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">None<\/span><\/td>\n<td><span style=\"font-weight: 400;\">null<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>V\u00ed d\u1ee5 m\u00e3 ngu\u1ed3n chuy\u1ec3n \u0111\u1ed5i t\u1eeb Python sang JSON:<\/strong><\/p>\n<pre><span style=\"font-weight: 400;\">import<\/span><span style=\"font-weight: 400;\"> json<\/span>\r\n\r\n<span style=\"font-weight: 400;\"># D\u1eef li\u1ec7u Python<\/span>\r\n<span style=\"font-weight: 400;\">person_dict = {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">\"name\"<\/span><span style=\"font-weight: 400;\">: <\/span><span style=\"font-weight: 400;\">\"John\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">\"age\"<\/span><span style=\"font-weight: 400;\">: <\/span><span style=\"font-weight: 400;\">30<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">\"city\"<\/span><span style=\"font-weight: 400;\">: <\/span><span style=\"font-weight: 400;\">\"New York\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">\"hasChildren\"<\/span><span style=\"font-weight: 400;\">: <\/span><span style=\"font-weight: 400;\">False<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">\"titles\"<\/span><span style=\"font-weight: 400;\">: [<\/span><span style=\"font-weight: 400;\">\"engineer\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"programmer\"<\/span><span style=\"font-weight: 400;\">]<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n\r\n<span style=\"font-weight: 400;\"># Chuy\u1ec3n \u0111\u1ed5i t\u1eeb Python sang JSON<\/span>\r\n<span style=\"font-weight: 400;\">person_json = json.dumps(person_dict, indent=<\/span><span style=\"font-weight: 400;\">4<\/span><span style=\"font-weight: 400;\">)<\/span>\r\n\r\n<span style=\"font-weight: 400;\">print(person_json)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 s\u1ebd hi\u1ec3n th\u1ecb:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \"name\": <\/span><span style=\"font-weight: 400;\">\"John\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \"age\": <\/span><span style=\"font-weight: 400;\">30<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \"city\": <\/span><span style=\"font-weight: 400;\">\"New York\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \"hasChildren\": <\/span><span style=\"font-weight: 400;\">false<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \"titles\": [<\/span><span style=\"font-weight: 400;\">\"engineer\"<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">\"programmer\"<\/span><span style=\"font-weight: 400;\">]<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<h4><b>V\u00ed d\u1ee5: Chuy\u1ec3n \u0111\u1ed5i JSON th\u00e0nh b\u1ea3ng v\u1edbi Pandas<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Gi\u1ea3 s\u1eed b\u1ea1n c\u00f3 m\u1ed9t file JSON ch\u1ee9a th\u00f4ng tin v\u1ec1 c\u00e1c s\u1ef1 ki\u1ec7n ng\u01b0\u1eddi d\u00f9ng tr\u00ean website:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">[<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \"user_id\": <\/span><span style=\"font-weight: 400;\">\"123\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \"event\": <\/span><span style=\"font-weight: 400;\">\"click\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \"timestamp\": <\/span><span style=\"font-weight: 400;\">\"2023-07-25T10:00:00Z\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \"details\": {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \"page\": <\/span><span style=\"font-weight: 400;\">\"home\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \"button_id\": <\/span><span style=\"font-weight: 400;\">\"signup\"<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 }<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 },<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \"user_id\": <\/span><span style=\"font-weight: 400;\">\"124\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \"event\": <\/span><span style=\"font-weight: 400;\">\"view\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \"timestamp\": <\/span><span style=\"font-weight: 400;\">\"2023-07-25T10:05:00Z\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \"details\": {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \"page\": <\/span><span style=\"font-weight: 400;\">\"products\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \"product_id\": <\/span><span style=\"font-weight: 400;\">\"A001\"<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 }<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 }<\/span>\r\n<span style=\"font-weight: 400;\">]<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 chuy\u1ec3n \u0111\u1ed5i d\u1eef li\u1ec7u n\u00e0y th\u00e0nh d\u1ea1ng b\u1ea3ng s\u1eed d\u1ee5ng Pandas, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng m\u00e3 ngu\u1ed3n sau:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import<\/span><span style=\"font-weight: 400;\"> json<\/span>\r\n<span style=\"font-weight: 400;\">import<\/span><span style=\"font-weight: 400;\"> pandas <\/span><span style=\"font-weight: 400;\">as<\/span><span style=\"font-weight: 400;\"> pd<\/span>\r\n\r\n<span style=\"font-weight: 400;\"># \u0110\u1ecdc d\u1eef li\u1ec7u JSON<\/span>\r\n<span style=\"font-weight: 400;\">with<\/span><span style=\"font-weight: 400;\"> open(<\/span><span style=\"font-weight: 400;\">'data.json'<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">'r'<\/span><span style=\"font-weight: 400;\">) <\/span><span style=\"font-weight: 400;\">as<\/span><span style=\"font-weight: 400;\"> file:<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 data = json.load(file)<\/span>\r\n\r\n<span style=\"font-weight: 400;\"># Chuy\u1ec3n \u0111\u1ed5i JSON th\u00e0nh DataFrame<\/span>\r\n<span style=\"font-weight: 400;\">df = pd.json_normalize(data, <\/span><span style=\"font-weight: 400;\">'details'<\/span><span style=\"font-weight: 400;\">, [<\/span><span style=\"font-weight: 400;\">'user_id'<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">'event'<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">'timestamp'<\/span><span style=\"font-weight: 400;\">])<\/span>\r\n\r\n<span style=\"font-weight: 400;\"># Hi\u1ec3n th\u1ecb DataFrame<\/span>\r\n<span style=\"font-weight: 400;\">print(df)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">K\u1ebft qu\u1ea3 s\u1ebd hi\u1ec3n th\u1ecb:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>page<\/b><\/td>\n<td><b>button_id<\/b><\/td>\n<td><b>product_id<\/b><\/td>\n<td><b>user_id<\/b><\/td>\n<td><b>event<\/b><\/td>\n<td><b>timestamp<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">home<\/span><\/td>\n<td><span style=\"font-weight: 400;\">signup<\/span><\/td>\n<td><span style=\"font-weight: 400;\">NaN<\/span><\/td>\n<td><span style=\"font-weight: 400;\">123<\/span><\/td>\n<td><span style=\"font-weight: 400;\">click<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2023-07-25T10:00:00Z<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">products<\/span><\/td>\n<td><span style=\"font-weight: 400;\">NaN<\/span><\/td>\n<td><span style=\"font-weight: 400;\">A001<\/span><\/td>\n<td><span style=\"font-weight: 400;\">124<\/span><\/td>\n<td><span style=\"font-weight: 400;\">view<\/span><\/td>\n<td><span style=\"font-weight: 400;\">2023-07-25T10:05:00Z<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">Khi d\u1eef li\u1ec7u \u0111\u00e3 \u0111\u01b0\u1ee3c chuy\u1ec3n \u0111\u1ed5i th\u00e0nh d\u1ea1ng b\u1ea3ng, b\u1ea1n c\u00f3 th\u1ec3 d\u1ec5 d\u00e0ng tr\u1ef1c quan h\u00f3a, so s\u00e1nh, l\u1ecdc v\u00e0 t\u00ednh to\u00e1n t\u1ed5ng h\u1ee3p m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3. C\u00e1c t\u00e1c v\u1ee5 n\u00e0y r\u1ea5t quan tr\u1ecdng \u0111\u1ed1i v\u1edbi vi\u1ec7c ph\u00e2n t\u00edch d\u1eef li\u1ec7u v\u00e0 th\u01b0\u1eddng kh\u00f4ng th\u1ec3 th\u1ef1c hi\u1ec7n \u0111\u01b0\u1ee3c ho\u1eb7c r\u1ea5t kh\u00f3 th\u1ef1c hi\u1ec7n tr\u00ean d\u1eef li\u1ec7u JSON thu\u1ea7n t\u00fay.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Luu_tru_JSON\"><\/span><strong>L\u01b0u tr\u1eef JSON<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><strong>L\u01b0u tr\u1eef JSON trong NoSQL Database<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">NoSQL databases nh\u01b0 MongoDB v\u00e0 Elasticsearch r\u1ea5t ph\u00f9 h\u1ee3p \u0111\u1ec3 l\u01b0u tr\u1eef d\u1eef li\u1ec7u JSON do kh\u1ea3 n\u0103ng l\u01b0u tr\u1eef t\u00e0i li\u1ec7u c\u00f3 c\u1ea5u tr\u00fac kh\u00f4ng c\u1ed1 \u0111\u1ecbnh. B\u1ea1n c\u00f3 th\u1ec3 d\u1ec5 d\u00e0ng l\u01b0u tr\u1eef v\u00e0 truy xu\u1ea5t d\u1eef li\u1ec7u JSON trong c\u00e1c h\u1ec7 th\u1ed1ng n\u00e0y.<\/span><\/p>\n<h4><b>T\u1ea1i sao c\u1ea7n l\u01b0u tr\u1eef d\u1eef li\u1ec7u JSON tr\u00ean NoSQL Database?<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>C\u1ea5u tr\u00fac linh ho\u1ea1t<\/b><span style=\"font-weight: 400;\">: NoSQL databases c\u00f3 kh\u1ea3 n\u0103ng l\u01b0u tr\u1eef d\u1eef li\u1ec7u v\u1edbi c\u1ea5u tr\u00fac kh\u00f4ng c\u1ed1 \u0111\u1ecbnh, cho ph\u00e9p b\u1ea1n l\u01b0u tr\u1eef c\u00e1c t\u00e0i li\u1ec7u JSON m\u00e0 kh\u00f4ng c\u1ea7n ph\u1ea3i \u0111\u1ecbnh ngh\u0129a tr\u01b0\u1edbc schema. \u0110i\u1ec1u n\u00e0y r\u1ea5t h\u1eefu \u00edch khi b\u1ea1n l\u00e0m vi\u1ec7c v\u1edbi d\u1eef li\u1ec7u kh\u00f4ng \u0111\u1ed3ng nh\u1ea5t ho\u1eb7c khi c\u1ea5u tr\u00fac d\u1eef li\u1ec7u c\u1ee7a b\u1ea1n thay \u0111\u1ed5i th\u01b0\u1eddng xuy\u00ean.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng<\/b><span style=\"font-weight: 400;\">: NoSQL databases \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf \u0111\u1ec3 d\u1ec5 d\u00e0ng m\u1edf r\u1ed9ng theo chi\u1ec1u ngang. B\u1ea1n c\u00f3 th\u1ec3 th\u00eam nhi\u1ec1u m\u00e1y ch\u1ee7 h\u01a1n \u0111\u1ec3 x\u1eed l\u00fd l\u01b0\u1ee3ng d\u1eef li\u1ec7u l\u1edbn m\u00e0 kh\u00f4ng g\u1eb7p v\u1ea5n \u0111\u1ec1 v\u1ec1 hi\u1ec7u su\u1ea5t.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Hi\u1ec7u su\u1ea5t cao<\/b><span style=\"font-weight: 400;\">: NoSQL databases \u0111\u01b0\u1ee3c t\u1ed1i \u01b0u h\u00f3a cho c\u00e1c thao t\u00e1c \u0111\u1ecdc v\u00e0 ghi nhanh ch\u00f3ng, gi\u00fap c\u1ea3i thi\u1ec7n hi\u1ec7u su\u1ea5t khi l\u00e0m vi\u1ec7c v\u1edbi d\u1eef li\u1ec7u JSON l\u1edbn.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>D\u1ec5 d\u00e0ng t\u00edch h\u1ee3p v\u00e0 truy v\u1ea5n<\/b><span style=\"font-weight: 400;\">: C\u00e1c c\u00f4ng c\u1ee5 NoSQL nh\u01b0 MongoDB v\u00e0 Elasticsearch cung c\u1ea5p c\u00e1c API m\u1ea1nh m\u1ebd v\u00e0 d\u1ec5 s\u1eed d\u1ee5ng \u0111\u1ec3 truy v\u1ea5n v\u00e0 thao t\u00e1c d\u1eef li\u1ec7u JSON. B\u1ea1n c\u00f3 th\u1ec3 th\u1ef1c hi\u1ec7n c\u00e1c truy v\u1ea5n ph\u1ee9c t\u1ea1p v\u00e0 ph\u00e2n t\u00edch d\u1eef li\u1ec7u m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3.<\/span><\/li>\n<\/ul>\n<h4><b>V\u00ed d\u1ee5 s\u1eed d\u1ee5ng Elasticsearch \u0111\u1ec3 l\u01b0u tr\u1eef JSON<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Elasticsearch l\u00e0 m\u1ed9t c\u00f4ng c\u1ee5 t\u00ecm ki\u1ebfm v\u00e0 ph\u00e2n t\u00edch m\u1ea1nh m\u1ebd, r\u1ea5t ph\u00f9 h\u1ee3p cho vi\u1ec7c l\u01b0u tr\u1eef v\u00e0 t\u00ecm ki\u1ebfm d\u1eef li\u1ec7u JSON. D\u01b0\u1edbi \u0111\u00e2y l\u00e0 m\u1ed9t v\u00ed d\u1ee5 \u0111\u01a1n gi\u1ea3n v\u1ec1 c\u00e1ch s\u1eed d\u1ee5ng th\u01b0 vi\u1ec7n <\/span><span style=\"font-weight: 400;\">elasticsearch-py<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 t\u1ea3i d\u1eef li\u1ec7u JSON v\u00e0o Elasticsearch b\u1eb1ng Python.<\/span><\/p>\n<p><b>C\u00e0i \u0111\u1eb7t th\u01b0 vi\u1ec7n <\/b><b>elasticsearch-py<\/b><span style=\"font-weight: 400;\">:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">pip install elasticsearch<\/span><\/pre>\n<p><b>T\u1ea3i d\u1eef li\u1ec7u JSON v\u00e0o Elasticsearch<\/b><span style=\"font-weight: 400;\">:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Gi\u1ea3 s\u1eed b\u1ea1n c\u00f3 m\u1ed9t file <\/span><span style=\"font-weight: 400;\">data.json<\/span><span style=\"font-weight: 400;\"> ch\u1ee9a c\u00e1c t\u00e0i li\u1ec7u JSON. B\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng m\u00e3 Python sau \u0111\u1ec3 t\u1ea3i d\u1eef li\u1ec7u n\u00e0y v\u00e0o m\u1ed9t index trong Elasticsearch:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">from<\/span><span style=\"font-weight: 400;\"> elasticsearch <\/span><span style=\"font-weight: 400;\">import<\/span><span style=\"font-weight: 400;\"> Elasticsearch, helpers<\/span>\r\n<span style=\"font-weight: 400;\">import<\/span><span style=\"font-weight: 400;\"> json<\/span>\r\n\r\n<span style=\"font-weight: 400;\"># K\u1ebft n\u1ed1i t\u1edbi Elasticsearch<\/span>\r\n<span style=\"font-weight: 400;\">es = Elasticsearch([{<\/span><span style=\"font-weight: 400;\">'host'<\/span><span style=\"font-weight: 400;\">: <\/span><span style=\"font-weight: 400;\">'localhost'<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">'port'<\/span><span style=\"font-weight: 400;\">: <\/span><span style=\"font-weight: 400;\">9200<\/span><span style=\"font-weight: 400;\">}])<\/span>\r\n\r\n<span style=\"font-weight: 400;\"># \u0110\u1ecdc d\u1eef li\u1ec7u JSON<\/span>\r\n<span style=\"font-weight: 400;\">with<\/span><span style=\"font-weight: 400;\"> open(<\/span><span style=\"font-weight: 400;\">'data.json'<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">'r'<\/span><span style=\"font-weight: 400;\">) <\/span><span style=\"font-weight: 400;\">as<\/span><span style=\"font-weight: 400;\"> file:<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 data = json.load(file)<\/span>\r\n\r\n<span style=\"font-weight: 400;\"># Chuy\u1ec3n \u0111\u1ed5i d\u1eef li\u1ec7u th\u00e0nh \u0111\u1ecbnh d\u1ea1ng ph\u00f9 h\u1ee3p \u0111\u1ec3 import v\u00e0o Elasticsearch<\/span>\r\n<span style=\"font-weight: 400;\">def<\/span><span style=\"font-weight: 400;\"> generate_data<\/span><span style=\"font-weight: 400;\">(data)<\/span><span style=\"font-weight: 400;\">:<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">for<\/span><span style=\"font-weight: 400;\"> entry <\/span><span style=\"font-weight: 400;\">in<\/span><span style=\"font-weight: 400;\"> data:<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">yield<\/span><span style=\"font-weight: 400;\"> {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">\"_index\"<\/span><span style=\"font-weight: 400;\">: <\/span><span style=\"font-weight: 400;\">\"user_events\"<\/span><span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"font-weight: 400;\">\"_source\"<\/span><span style=\"font-weight: 400;\">: entry<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 }<\/span>\r\n\r\n<span style=\"font-weight: 400;\"># T\u1ea3i d\u1eef li\u1ec7u v\u00e0o Elasticsearch<\/span>\r\n<span style=\"font-weight: 400;\">helpers.bulk(es, generate_data(data))<\/span>\r\n\r\n<span style=\"font-weight: 400;\">print(<\/span><span style=\"font-weight: 400;\">\"D\u1eef li\u1ec7u \u0111\u00e3 \u0111\u01b0\u1ee3c t\u1ea3i v\u00e0o Elasticsearch th\u00e0nh c\u00f4ng!\"<\/span><span style=\"font-weight: 400;\">)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Trong v\u00ed d\u1ee5 n\u00e0y:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>K\u1ebft n\u1ed1i t\u1edbi Elasticsearch<\/b><span style=\"font-weight: 400;\">: S\u1eed d\u1ee5ng <\/span><span style=\"font-weight: 400;\">Elasticsearch([{&#8216;host&#8217;: &#8216;localhost&#8217;, &#8216;port&#8217;: 9200}])<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 k\u1ebft n\u1ed1i t\u1edbi Elasticsearch \u0111ang ch\u1ea1y tr\u00ean m\u00e1y c\u1ee5c b\u1ed9 \u1edf c\u1ed5ng 9200.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>\u0110\u1ecdc d\u1eef li\u1ec7u JSON<\/b><span style=\"font-weight: 400;\">: S\u1eed d\u1ee5ng <\/span><span style=\"font-weight: 400;\">json.load(file)<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 \u0111\u1ecdc d\u1eef li\u1ec7u t\u1eeb file JSON.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Chuy\u1ec3n \u0111\u1ed5i d\u1eef li\u1ec7u<\/b><span style=\"font-weight: 400;\">: H\u00e0m <\/span><span style=\"font-weight: 400;\">generate_data(data)<\/span><span style=\"font-weight: 400;\"> chuy\u1ec3n \u0111\u1ed5i d\u1eef li\u1ec7u JSON th\u00e0nh \u0111\u1ecbnh d\u1ea1ng ph\u00f9 h\u1ee3p \u0111\u1ec3 t\u1ea3i v\u00e0o Elasticsearch.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>T\u1ea3i d\u1eef li\u1ec7u v\u00e0o Elasticsearch<\/b><span style=\"font-weight: 400;\">: S\u1eed d\u1ee5ng <\/span><span style=\"font-weight: 400;\">helpers.bulk(es, generate_data(data))<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 t\u1ea3i d\u1eef li\u1ec7u v\u00e0o Elasticsearch.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Vi\u1ec7c s\u1eed d\u1ee5ng Elasticsearch \u0111\u1ec3 l\u01b0u tr\u1eef v\u00e0 t\u00ecm ki\u1ebfm d\u1eef li\u1ec7u JSON gi\u00fap b\u1ea1n t\u1eadn d\u1ee5ng \u0111\u01b0\u1ee3c s\u1ee9c m\u1ea1nh c\u1ee7a c\u00f4ng c\u1ee5 t\u00ecm ki\u1ebfm v\u00e0 ph\u00e2n t\u00edch m\u1ea1nh m\u1ebd n\u00e0y, h\u1ed7 tr\u1ee3 qu\u00e1 tr\u00ecnh x\u1eed l\u00fd v\u00e0 ph\u00e2n t\u00edch d\u1eef li\u1ec7u c\u1ee7a b\u1ea1n m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3.<\/span><\/p>\n<h3><strong>L\u01b0u tr\u1eef JSON tr\u00ean RDBMS Database<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">M\u1eb7c d\u00f9 RDBMS (Relational Database Management System) th\u01b0\u1eddng l\u01b0u tr\u1eef d\u1eef li\u1ec7u d\u01b0\u1edbi d\u1ea1ng b\u1ea3ng, nhi\u1ec1u h\u1ec7 qu\u1ea3n tr\u1ecb c\u01a1 s\u1edf d\u1eef li\u1ec7u quan h\u1ec7 hi\u1ec7n \u0111\u1ea1i nh\u01b0 PostgreSQL v\u00e0 MySQL h\u1ed7 tr\u1ee3 l\u01b0u tr\u1eef d\u1eef li\u1ec7u JSON tr\u1ef1c ti\u1ebfp trong c\u00e1c c\u1ed9t JSON ho\u1eb7c JSONB. Tuy nhi\u00ean, v\u1edbi c\u00e1c c\u01a1 s\u1edf d\u1eef li\u1ec7u c\u0169 h\u01a1n ho\u1eb7c khi ch\u1ec9 c\u1ea7n l\u01b0u tr\u1eef v\u00e0 ph\u00e2n t\u00edch m\u1ed9t ph\u1ea7n th\u00f4ng tin t\u1eeb JSON, vi\u1ec7c chuy\u1ec3n \u0111\u1ed5i d\u1eef li\u1ec7u JSON th\u00e0nh c\u00e1c b\u1ea3ng quan h\u1ec7 l\u00e0 r\u1ea5t quan tr\u1ecdng.<\/span><\/p>\n<h4><b>T\u1ea1i sao vi\u1ec7c chuy\u1ec3n \u0111\u1ed5i JSON th\u00e0nh d\u1ea1ng b\u1ea3ng l\u1ea1i quan tr\u1ecdng?<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Ph\u00e2n t\u00edch d\u1eef li\u1ec7u d\u1ec5 d\u00e0ng h\u01a1n<\/b><span style=\"font-weight: 400;\">: Chuy\u1ec3n \u0111\u1ed5i JSON th\u00e0nh c\u00e1c b\u1ea3ng quan h\u1ec7 gi\u00fap truy v\u1ea5n v\u00e0 ph\u00e2n t\u00edch d\u1eef li\u1ec7u d\u1ec5 d\u00e0ng h\u01a1n. SQL c\u00f3 s\u1ee9c m\u1ea1nh truy v\u1ea5n cao v\u00e0 cho ph\u00e9p l\u1eadp tr\u00ecnh vi\u00ean s\u1eed d\u1ee5ng c\u00e1c c\u00e2u l\u1ec7nh JOIN, GROUP BY, v\u00e0 c\u00e1c h\u00e0m ph\u00e2n t\u00edch kh\u00e1c \u0111\u1ec3 kh\u00e1m ph\u00e1 d\u1eef li\u1ec7u m\u1ed9t c\u00e1ch s\u00e2u s\u1eafc h\u01a1n.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>T\u1ed1i \u01b0u h\u00f3a hi\u1ec7u su\u1ea5t<\/b><span style=\"font-weight: 400;\">: Khi d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef d\u01b0\u1edbi d\u1ea1ng b\u1ea3ng, h\u1ec7 qu\u1ea3n tr\u1ecb c\u01a1 s\u1edf d\u1eef li\u1ec7u c\u00f3 th\u1ec3 t\u1ed1i \u01b0u h\u00f3a ch\u1ec9 m\u1ee5c v\u00e0 b\u1ed9 nh\u1edb \u0111\u1ec7m \u0111\u1ec3 t\u0103ng t\u1ed1c \u0111\u1ed9 truy v\u1ea5n. \u0110i\u1ec1u n\u00e0y \u0111\u1eb7c bi\u1ec7t h\u1eefu \u00edch khi l\u00e0m vi\u1ec7c v\u1edbi c\u00e1c b\u1ed9 d\u1eef li\u1ec7u l\u1edbn.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>L\u01b0u tr\u1eef linh ho\u1ea1t<\/b><span style=\"font-weight: 400;\">: Kh\u00f4ng ph\u1ea3i m\u1ecdi th\u00f4ng tin trong JSON \u0111\u1ec1u c\u1ea7n \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef trong data warehouse. Vi\u1ec7c ch\u1ecdn l\u1ecdc v\u00e0 chuy\u1ec3n \u0111\u1ed5i ch\u1ec9 nh\u1eefng th\u00f4ng tin c\u1ea7n thi\u1ebft gi\u00fap ti\u1ebft ki\u1ec7m kh\u00f4ng gian l\u01b0u tr\u1eef v\u00e0 qu\u1ea3n l\u00fd d\u1eef li\u1ec7u hi\u1ec7u qu\u1ea3 h\u01a1n.<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Cong_cu_dinh_dang_JSON\"><\/span><strong>C\u00f4ng c\u1ee5 \u0111\u1ecbnh d\u1ea1ng JSON<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><strong>JSON Formatter l\u00e0 g\u00ec v\u00e0 t\u1ea1i sao s\u1eed d\u1ee5ng?<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">JSON Formatter l\u00e0 c\u00f4ng c\u1ee5 gi\u00fap \u0111\u1ecbnh d\u1ea1ng v\u00e0 c\u1ea3i thi\u1ec7n c\u00fa ph\u00e1p c\u1ee7a d\u1eef li\u1ec7u JSON. N\u00f3 th\u00eam d\u1ea5u ng\u1eaft d\u00f2ng v\u00e0 th\u1ee5t l\u1ec1 v\u00e0o c\u00e1c \u0111o\u1ea1n m\u00e3 JSON, gi\u00fap d\u1eef li\u1ec7u d\u1ec5 \u0111\u1ecdc v\u00e0 g\u1ee1 l\u1ed7i h\u01a1n. Vi\u1ec7c s\u1eed d\u1ee5ng JSON Formatter mang l\u1ea1i nhi\u1ec1u l\u1ee3i \u00edch:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>C\u1ea3i thi\u1ec7n kh\u1ea3 n\u0103ng \u0111\u1ecdc<\/b><span style=\"font-weight: 400;\">: JSON Formatter gi\u00fap c\u00e1c \u0111o\u1ea1n m\u00e3 JSON d\u1ec5 \u0111\u1ecdc h\u01a1n, \u0111\u1eb7c bi\u1ec7t l\u00e0 khi l\u00e0m vi\u1ec7c v\u1edbi d\u1eef li\u1ec7u ph\u1ee9c t\u1ea1p. N\u00f3 th\u00eam c\u00e1c k\u00fd t\u1ef1 ng\u1eaft d\u00f2ng v\u00e0 th\u1ee5t l\u1ec1 \u0111\u1ec3 t\u1ed5 ch\u1ee9c d\u1eef li\u1ec7u theo c\u1ea5u tr\u00fac r\u00f5 r\u00e0ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>D\u1ec5 d\u00e0ng g\u1ee1 l\u1ed7i<\/b><span style=\"font-weight: 400;\">: Khi d\u1eef li\u1ec7u JSON \u0111\u01b0\u1ee3c \u0111\u1ecbnh d\u1ea1ng m\u1ed9t c\u00e1ch c\u00f3 h\u1ec7 th\u1ed1ng, vi\u1ec7c ph\u00e1t hi\u1ec7n v\u00e0 s\u1eeda l\u1ed7i tr\u1edf n\u00ean d\u1ec5 d\u00e0ng h\u01a1n. JSON Formatter gi\u00fap l\u1eadp tr\u00ecnh vi\u00ean nhanh ch\u00f3ng x\u00e1c \u0111\u1ecbnh c\u00e1c l\u1ed7i c\u00fa ph\u00e1p v\u00e0 c\u00e1c v\u1ea5n \u0111\u1ec1 kh\u00e1c trong d\u1eef li\u1ec7u.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>\u0110\u1ea3m b\u1ea3o t\u00ednh ch\u00ednh x\u00e1c<\/b><span style=\"font-weight: 400;\">: M\u1ed9t s\u1ed1 c\u00f4ng c\u1ee5 JSON Formatter kh\u00f4ng ch\u1ec9 \u0111\u1ecbnh d\u1ea1ng m\u00e0 c\u00f2n x\u00e1c th\u1ef1c c\u00fa ph\u00e1p JSON, \u0111\u1ea3m b\u1ea3o r\u1eb1ng d\u1eef li\u1ec7u tu\u00e2n th\u1ee7 c\u00e1c quy t\u1eafc \u0111\u1ecbnh d\u1ea1ng chu\u1ea9n v\u00e0 kh\u00f4ng c\u00f3 l\u1ed7i.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>\u0110\u01a1n gi\u1ea3n h\u00f3a qu\u00e1 tr\u00ecnh ph\u00e1t tri\u1ec3n<\/b><span style=\"font-weight: 400;\">: Khi l\u00e0m vi\u1ec7c v\u1edbi c\u00e1c \u1ee9ng d\u1ee5ng web v\u00e0 trao \u0111\u1ed5i d\u1eef li\u1ec7u gi\u1eefa m\u00e1y ch\u1ee7 v\u00e0 m\u00e1y kh\u00e1ch, vi\u1ec7c s\u1eed d\u1ee5ng JSON Formatter gi\u00fap qu\u00e1 tr\u00ecnh ph\u00e1t tri\u1ec3n tr\u1edf n\u00ean m\u01b0\u1ee3t m\u00e0 v\u00e0 hi\u1ec7u qu\u1ea3 h\u01a1n.<\/span><\/li>\n<\/ul>\n<h3><strong>C\u00e1c c\u00f4ng c\u1ee5 \u0111\u1ecbnh d\u1ea1ng JSON ph\u1ed5 bi\u1ebfn<\/strong><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/jsonlint.com\/\" target=\"_blank\" rel=\"noopener\"><b>JSONLint<\/b><\/a><span style=\"font-weight: 400;\">: C\u00f4ng c\u1ee5 tr\u1ef1c tuy\u1ebfn gi\u00fap ph\u00e1t hi\u1ec7n l\u1ed7i s\u1edbm v\u00e0 \u0111\u1ec1 xu\u1ea5t c\u00e1c ch\u1ec9nh s\u1eeda \u0111\u1ec3 ho\u00e0n thi\u1ec7n c\u1ea5u tr\u00fac d\u1eef li\u1ec7u JSON.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/jsonformatter.curiousconcept.com\/\" target=\"_blank\" rel=\"noopener\"><b>JSON Formatter &amp; Validator<\/b><\/a><span style=\"font-weight: 400;\">: C\u00f4ng c\u1ee5 tr\u1ef1c tuy\u1ebfn gi\u00fap \u0111\u1ecbnh d\u1ea1ng v\u00e0 x\u00e1c th\u1ef1c d\u1eef li\u1ec7u JSON, \u0111\u1ea3m b\u1ea3o t\u00ednh ch\u00ednh x\u00e1c v\u00e0 d\u1ec5 \u0111\u1ecdc.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/code.visualstudio.com\/\" target=\"_blank\" rel=\"noopener\"><b>Visual Studio Code<\/b><\/a><span style=\"font-weight: 400;\">: IDE ph\u1ed5 bi\u1ebfn v\u1edbi c\u00e1c ti\u1ec7n \u00edch m\u1edf r\u1ed9ng h\u1ed7 tr\u1ee3 \u0111\u1ecbnh d\u1ea1ng v\u00e0 x\u00e1c th\u1ef1c JSON tr\u1ef1c ti\u1ebfp trong m\u00f4i tr\u01b0\u1eddng ph\u00e1t tri\u1ec3n.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/www.jsonschemavalidator.net\/\" target=\"_blank\" rel=\"noopener\"><b>JSON Schema Validator<\/b><\/a><span style=\"font-weight: 400;\">: C\u00f4ng c\u1ee5 gi\u00fap x\u00e1c minh t\u00ednh to\u00e0n v\u1eb9n c\u1ee7a d\u1eef li\u1ec7u JSON, \u0111\u1ea3m b\u1ea3o r\u1eb1ng m\u00e3 JSON tu\u00e2n th\u1ee7 schema ho\u1eb7c c\u00e1c quy t\u1eafc \u0111\u01b0\u1ee3c x\u00e1c \u0111\u1ecbnh tr\u01b0\u1edbc.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"https:\/\/codebeautify.org\/jsonviewer\" target=\"_blank\" rel=\"noopener\"><b>JSON Beautifier<\/b><\/a><span style=\"font-weight: 400;\">: C\u00f4ng c\u1ee5 t\u1ef1 \u0111\u1ed9ng \u0111\u1ecbnh d\u1ea1ng c\u1ea5u tr\u00fac d\u1eef li\u1ec7u JSON, gi\u00fap tr\u00ecnh b\u00e0y d\u1eef li\u1ec7u m\u1ed9t c\u00e1ch r\u00f5 r\u00e0ng v\u00e0 d\u1ec5 hi\u1ec3u h\u01a1n.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">S\u1eed d\u1ee5ng c\u00e1c c\u00f4ng c\u1ee5 n\u00e0y gi\u00fap b\u1ea1n d\u1ec5 d\u00e0ng qu\u1ea3n l\u00fd, ki\u1ec3m tra v\u00e0 x\u1eed l\u00fd d\u1eef li\u1ec7u JSON trong qu\u00e1 tr\u00ecnh ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng, \u0111\u1ea3m b\u1ea3o hi\u1ec7u su\u1ea5t v\u00e0 \u0111\u1ed9 tin c\u1eady c\u1ee7a h\u1ec7 th\u1ed1ng.<\/span><\/p>\n<blockquote><p><em>\u0110\u1ecdc th\u00eam: <a href=\"https:\/\/itviec.com\/blog\/cong-cu-dinh-dang-json-online\/\" target=\"_blank\" rel=\"noopener\"><strong>JSON Online: T\u1ed5ng h\u1ee3p c\u00f4ng c\u1ee5 \u0111\u1ecbnh d\u1ea1ng JSON Online<\/strong><\/a><\/em><\/p><\/blockquote>\n<h2><span class=\"ez-toc-section\" id=\"Cau_hoi_thuong_gap_ve_JSON_Python\"><\/span><strong>C\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 JSON Python<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><strong>S\u1ef1 kh\u00e1c bi\u1ec7t gi\u1eefa json.dump() v\u00e0 json.dumps() l\u00e0 g\u00ec?<\/strong><\/h3>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">json.dump()<\/span><span style=\"font-weight: 400;\"> ghi d\u1eef li\u1ec7u Python v\u00e0o m\u1ed9t file JSON.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">json.dumps()<\/span><span style=\"font-weight: 400;\"> chuy\u1ec3n \u0111\u1ed5i d\u1eef li\u1ec7u Python th\u00e0nh m\u1ed9t chu\u1ed7i JSON.<\/span><\/li>\n<\/ul>\n<h3><strong>L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 \u0111\u1ecbnh d\u1ea1ng l\u1ea1i d\u1eef li\u1ec7u JSON \u0111\u1ec3 d\u1ec5 \u0111\u1ecdc h\u01a1n?<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">S\u1eed d\u1ee5ng tham s\u1ed1 <\/span><span style=\"font-weight: 400;\">indent<\/span><span style=\"font-weight: 400;\"> trong <\/span><span style=\"font-weight: 400;\">json.dumps()<\/span><span style=\"font-weight: 400;\"> ho\u1eb7c <\/span><span style=\"font-weight: 400;\">json.dump()<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 th\u00eam th\u1ee5t l\u1ec1 v\u00e0 ng\u1eaft d\u00f2ng.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Tong_ket_JSON_Python_phan_1\"><\/span><strong>T\u1ed5ng k\u1ebft JSON Python ph\u1ea7n 1<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Trong b\u00e0i vi\u1ebft n\u00e0y, ch\u00fang ta \u0111\u00e3 c\u00f9ng kh\u00e1m ph\u00e1 c\u00e1c thao t\u00e1c c\u01a1 b\u1ea3n v\u1edbi JSON trong Python, t\u1eeb vi\u1ec7c \u0111\u1ecdc v\u00e0 ghi d\u1eef li\u1ec7u, chuy\u1ec3n \u0111\u1ed5i gi\u1eefa c\u00e1c \u0111\u1ecbnh d\u1ea1ng \u0111\u1ebfn l\u01b0u tr\u1eef JSON. Python v\u1edbi th\u01b0 vi\u1ec7n t\u00edch h\u1ee3p s\u1eb5n gi\u00fap vi\u1ec7c x\u1eed l\u00fd JSON tr\u1edf n\u00ean d\u1ec5 d\u00e0ng v\u00e0 hi\u1ec7u qu\u1ea3, l\u00e0 c\u00f4ng c\u1ee5 kh\u00f4ng th\u1ec3 thi\u1ebfu cho c\u00e1c l\u1eadp tr\u00ecnh vi\u00ean v\u00e0 Data Engineer.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">N\u1ebfu b\u1ea1n mu\u1ed1n hi\u1ec3u s\u00e2u h\u01a1n v\u1ec1 c\u00e1ch l\u00e0m vi\u1ec7c v\u1edbi JSON trong Python, h\u00e3y \u0111\u00f3n \u0111\u1ecdc ph\u1ea7n 2 v\u1ec1 c\u00e1c \u1ee9ng d\u1ee5ng th\u1ef1c t\u1ebf c\u1ee7a JSON. Ch\u00fang ta s\u1ebd c\u00f9ng kh\u00e1m ph\u00e1 c\u00e1ch c\u1eadp nh\u1eadt n\u1ed9i dung web, ghi log, ph\u00e1t tri\u1ec3n API, web scraping v\u00e0 nhi\u1ec1u \u0111i\u1ec1u th\u00fa v\u1ecb kh\u00e1c n\u1eefa. \u0110\u1eebng b\u1ecf l\u1ee1 nh\u00e9!<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>JSON (JavaScript Object Notation) l\u00e0 m\u1ed9t \u0111\u1ecbnh d\u1ea1ng trao \u0111\u1ed5i d\u1eef li\u1ec7u si\u00eau nh\u1eb9 v\u00e0 d\u1ec5 \u0111\u1ecdc, ph\u00f9 h\u1ee3p cho c\u1ea3 con ng\u01b0\u1eddi l\u1eabn m\u00e1y m\u00f3c. Trong th\u1ebf gi\u1edbi l\u1eadp tr\u00ecnh v\u00e0 khoa h\u1ecdc d\u1eef li\u1ec7u, JSON \u0111\u01b0\u1ee3c \u01b0a chu\u1ed9ng \u0111\u1ec3 truy\u1ec1n t\u1ea3i d\u1eef li\u1ec7u gi\u1eefa m\u00e1y ch\u1ee7 v\u00e0 \u1ee9ng d\u1ee5ng web, c\u0169ng nh\u01b0 l\u01b0u [&hellip;]<\/p>\n","protected":false},"author":222,"featured_media":77549,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_gspb_post_css":"","footnotes":""},"categories":[109],"tags":[],"class_list":["post-77305","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chuyen-mon-it"],"blocksy_meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>JSON Python ph\u1ea7n 1: Thao t\u00e1c JSON c\u01a1 b\u1ea3n v\u1edbi Python - ITviec Blog<\/title>\n<meta name=\"description\" content=\"JSON th\u01b0\u1eddng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 truy\u1ec1n t\u1ea3i th\u00f4ng tin v\u00e0 Python c\u00f3 kh\u1ea3 n\u0103ng x\u1eed l\u00fd JSON hi\u1ec7u qu\u1ea3. B\u00e0i vi\u1ebft t\u1ed5ng h\u1ee3p c\u00e1c thao t\u00e1c JSON trong Python.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itviec.com\/blog\/json-python-co-ban\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JSON Python ph\u1ea7n 1: Thao t\u00e1c JSON c\u01a1 b\u1ea3n v\u1edbi Python\" \/>\n<meta property=\"og:description\" content=\"JSON (JavaScript Object Notation) l\u00e0 m\u1ed9t \u0111\u1ecbnh d\u1ea1ng trao \u0111\u1ed5i d\u1eef li\u1ec7u si\u00eau nh\u1eb9 v\u00e0 d\u1ec5 \u0111\u1ecdc, ph\u00f9 h\u1ee3p cho c\u1ea3 con ng\u01b0\u1eddi l\u1eabn m\u00e1y m\u00f3c. Trong th\u1ebf gi\u1edbi l\u1eadp tr\u00ecnh v\u00e0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itviec.com\/blog\/json-python-co-ban\/\" \/>\n<meta property=\"og:site_name\" content=\"ITviec Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ITviec\" \/>\n<meta property=\"article:published_time\" content=\"2024-08-29T10:09:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/json-python-thumbnail-vippro.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2850\" \/>\n\t<meta property=\"og:image:height\" content=\"1500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Nguy\u1ec5n H\u1eefu V\u0103n\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ITviec\" \/>\n<meta name=\"twitter:site\" content=\"@ITviec\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nguy\u1ec5n H\u1eefu V\u0103n\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 ph\u00fat\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JSON Python ph\u1ea7n 1: Thao t\u00e1c JSON c\u01a1 b\u1ea3n v\u1edbi Python - ITviec Blog","description":"JSON th\u01b0\u1eddng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 truy\u1ec1n t\u1ea3i th\u00f4ng tin v\u00e0 Python c\u00f3 kh\u1ea3 n\u0103ng x\u1eed l\u00fd JSON hi\u1ec7u qu\u1ea3. B\u00e0i vi\u1ebft t\u1ed5ng h\u1ee3p c\u00e1c thao t\u00e1c JSON trong Python.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itviec.com\/blog\/json-python-co-ban\/","og_locale":"vi_VN","og_type":"article","og_title":"JSON Python ph\u1ea7n 1: Thao t\u00e1c JSON c\u01a1 b\u1ea3n v\u1edbi Python","og_description":"JSON (JavaScript Object Notation) l\u00e0 m\u1ed9t \u0111\u1ecbnh d\u1ea1ng trao \u0111\u1ed5i d\u1eef li\u1ec7u si\u00eau nh\u1eb9 v\u00e0 d\u1ec5 \u0111\u1ecdc, ph\u00f9 h\u1ee3p cho c\u1ea3 con ng\u01b0\u1eddi l\u1eabn m\u00e1y m\u00f3c. Trong th\u1ebf gi\u1edbi l\u1eadp tr\u00ecnh v\u00e0","og_url":"https:\/\/itviec.com\/blog\/json-python-co-ban\/","og_site_name":"ITviec Blog","article_publisher":"https:\/\/www.facebook.com\/ITviec","article_published_time":"2024-08-29T10:09:05+00:00","og_image":[{"width":2850,"height":1500,"url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/json-python-thumbnail-vippro.png","type":"image\/png"}],"author":"Nguy\u1ec5n H\u1eefu V\u0103n","twitter_card":"summary_large_image","twitter_creator":"@ITviec","twitter_site":"@ITviec","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"Nguy\u1ec5n H\u1eefu V\u0103n","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"15 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itviec.com\/blog\/json-python-co-ban\/#article","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/json-python-co-ban\/"},"author":{"name":"Nguy\u1ec5n H\u1eefu V\u0103n","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/a77cc13f89eaa58f59d8772448febe5f"},"headline":"JSON Python ph\u1ea7n 1: Thao t\u00e1c JSON c\u01a1 b\u1ea3n v\u1edbi Python","datePublished":"2024-08-29T10:09:05+00:00","mainEntityOfPage":{"@id":"https:\/\/itviec.com\/blog\/json-python-co-ban\/"},"wordCount":3884,"publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"image":{"@id":"https:\/\/itviec.com\/blog\/json-python-co-ban\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/json-python-thumbnail-vippro.png","articleSection":["Chuy\u00ean m\u00f4n IT"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/itviec.com\/blog\/json-python-co-ban\/","url":"https:\/\/itviec.com\/blog\/json-python-co-ban\/","name":"JSON Python ph\u1ea7n 1: Thao t\u00e1c JSON c\u01a1 b\u1ea3n v\u1edbi Python - ITviec Blog","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itviec.com\/blog\/json-python-co-ban\/#primaryimage"},"image":{"@id":"https:\/\/itviec.com\/blog\/json-python-co-ban\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/json-python-thumbnail-vippro.png","datePublished":"2024-08-29T10:09:05+00:00","description":"JSON th\u01b0\u1eddng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 truy\u1ec1n t\u1ea3i th\u00f4ng tin v\u00e0 Python c\u00f3 kh\u1ea3 n\u0103ng x\u1eed l\u00fd JSON hi\u1ec7u qu\u1ea3. B\u00e0i vi\u1ebft t\u1ed5ng h\u1ee3p c\u00e1c thao t\u00e1c JSON trong Python.","breadcrumb":{"@id":"https:\/\/itviec.com\/blog\/json-python-co-ban\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itviec.com\/blog\/json-python-co-ban\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/json-python-co-ban\/#primaryimage","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/json-python-thumbnail-vippro.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/08\/json-python-thumbnail-vippro.png","width":2850,"height":1500,"caption":"json python - itviec blog"},{"@type":"BreadcrumbList","@id":"https:\/\/itviec.com\/blog\/json-python-co-ban\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Chuy\u00ean m\u00f4n IT","item":"https:\/\/itviec.com\/blog\/chuyen-mon-it\/"},{"@type":"ListItem","position":2,"name":"JSON Python ph\u1ea7n 1: Thao t\u00e1c JSON c\u01a1 b\u1ea3n v\u1edbi Python"}]},{"@type":"WebSite","@id":"https:\/\/itviec.com\/blog\/#website","url":"https:\/\/itviec.com\/blog\/","name":"ITviec Blog","description":"IT Jobs &amp; People in Vietnam","publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itviec.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/itviec.com\/blog\/#organization","name":"ITviec","url":"https:\/\/itviec.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","width":1800,"height":1800,"caption":"ITviec"},"image":{"@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ITviec","https:\/\/x.com\/ITviec","https:\/\/www.linkedin.com\/company\/itviec","https:\/\/www.youtube.com\/channel\/UCYthAQ3bcGr57M_ag5gHDvQ"]},{"@type":"Person","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/a77cc13f89eaa58f59d8772448febe5f","name":"Nguy\u1ec5n H\u1eefu V\u0103n","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/TR-Nguyen-Huu-Van-vippro-e1712136004193-100x100.jpg","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/TR-Nguyen-Huu-Van-vippro-e1712136004193-100x100.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/TR-Nguyen-Huu-Van-vippro-e1712136004193-100x100.jpg","caption":"Nguy\u1ec5n H\u1eefu V\u0103n"},"url":"https:\/\/itviec.com\/blog\/author\/nguyen-huu-van-2\/"}]}},"_links":{"self":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/77305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/users\/222"}],"replies":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/comments?post=77305"}],"version-history":[{"count":0,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/77305\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media\/77549"}],"wp:attachment":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media?parent=77305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/categories?post=77305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/tags?post=77305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}