PageSourceSearch

https://mockoon.com/_next/static/chunks/pages/tools/json-minifier-1f318ad0a21c96d5.js

js mockoon.com collected 2026-10-03 19:37:15 UTC 12,450 bytes, 26 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[864],{5977:(e,s,n)=>{"use strict";n.d(s,{A:()=>t});var r=n(37876),a=n(14232);let t=function({title:e,subtitle:s,cta:n=null,ctaContent:t,mainPicture:l=null,mainPictureAlt:i=null,mainPictureWidth:c,mainPictureHeight:o,mainPictureSkewed:d,children:h}){return d=d??!0,(0,r.jsx)("section",{className:`position-relative ${l?"py-lg-10 py-5 mb-4":"pt-8 pb-4"}`,children:(0,r.jsx)("div",{className:"container",children:(0,r.jsxs)("div",{className:"row align-items-center",children:[(0,r.jsxs)("div",{className:`col-12 ${l?"col-lg-6":"col-lg-8 mx-auto text-center"}`,children:[e&&(0,r.jsx)("h1",{dangerouslySetInnerHTML:{__html:e},className:`display-4 text-center fw-medium ${l?"text-lg-start":""} `}),s&&(0,r.jsx)("p",{className:`lead ${l?"text-lg-start":""}  text-center text-gray-700 mb-6 mb-lg-8`,dangerouslySetInnerHTML:{__html:s}}),n&&(0,r.jsx)("div",{className:`hero-cta ${l?"text-lg-start":""} text-center`,children:n.map((e,s)=>(0,r.jsxs)(a.Fragment,{children:[(0,r.jsx)("a",{href:e.link,target:e.blank?"_blank":void 0,className:"me-2",children:(0,r.jsx)("button",{className:`btn btn-primary${s>0?"-subtle":""} lift`,children:(0,r.jsxs)("span",{children:[e.text," ",e.link.includes("download")&&(0,r.jsx)("i",{className:"icon-file_download ps-2"})]})})}),e.subtitle&&(0,r.jsx)("p",{className:"m-0 text-gray-700 fst-italic",children:(0,r.jsx)("small",{children:e.subt
1itle})})]},s))}),t,(0,r.jsx)("div",{className:"mt-10",children:h})]}),l&&(0,r.jsx)("div",{className:"col-12 col-lg-6 mt-10 mt-lg-0",children:(0,r.jsx)("div",{className:`${d?"skewed-screenshot":""} mb-8 mb-lg-0`,children:(0,r.jsx)("img",{src:l,alt:i,loading:"lazy",className:" img-fluid ",width:c,height:o})})})]})})})}},20471:(e,s,n)=>{"use strict";n.d(s,{A:()=>a});var r=n(37876);let a=function({colorScheme:e,children:s}){return(0,r.jsx)("div",{className:`quote bg-${e}-subtle border-start border-${e} border-4 p-4 my-4`,role:"alert",children:s})}},24535:(e,s,n)=>{"use strict";n.r(s),n.d(s,{default:()=>d});var r=n(37876),a=n(14232),t=n(89032),l=n(5977),i=n(98642),c=n(59751),o=n(33076);let d=function(){let[e]=(0,a.useState)(`{
2  "property": {
3    "value": "example_value",
4    "list_of_properties": [
5      {
6        "property_1": "value_1"
7      },
8      {
9        "property_2": "value_2"
10      },
11      {
12        "property_3": "value_3"
13      }
14    ],
15    "nested_properties": {
16      "nested_property": {
17        "nested_value": "nested_example_value"
18      }
19    },
20    "multiple_values_for_property": [
21      "value_1",
22      "value_2",
23      "value_3"
24    ]
25  }
26}`),[s,n]=(0,a.useState)('{"property":{"value":"example_value","list_of_properties":[{"property_1":"value_1"},{"property_2":"value_2"},{"property_3":"value_3"}],"nested_properties":{"nested_property":{"nested_value":"nested_example_value"}},"multiple_values_for_property":["value_1","value_2","value_3"]}}');return(0,r.jsxs)(o.A,{footerBanner:"download",children:[(0,r.jsx)(i.A,{title:"Online JSON minifier",description:"Minify your JSON data online and make it more compact and lightweight by removing unnecessary spaces, characters and line returns."}),(0,r.jsx)(l.A,{title:'Online <span class="text-primary">JSON minifier</span>',subtitle:"Minify your JSON data online and make it more compact and lightweight by removing unnecessary characters"}),(0,r.jsx)("section",{className:"pb-5 pb-lg-10",children:(0,r.jsx)("div",{className:"container",children:(0,r.jsxs)("div",{className:"code-editor-layout-dual",children:[(0,r.jsx)("div",{className:"code-editor-container",children:(0,r.jsx)(t.A,{value:e,onValueChange:e=>{try{n(JSON.stringify(JSON.parse(e)))}catch(e){}}})}),(0,r.jsx)("div",{className:"code-editor-sync m-2 fs-1 text-gray-600 align-self-center text-center",children:(0,r.jsx)("i",{className:"icon-arrow_forward"})}),(0,r.jsx)("div",{className:"code-editor-container",children:(0,r.jsx)(t.A,{value:s})})]})})}),(0,r.jsx)("section",{className:"pb-5 pb-lg-10",children:(0,r.jsx)("div",{className:"container",children:(0,r.jsx)(c.A,{})})}),(0,r.jsx)("section",{className:"pb-5 pb-lg-10",children:(0,r.jsx)("div",{className:"container",children:(0,r.jsx)("div",{className:"row",children:(0,r.jsxs)("div",{className:"col-12",children:[(0,r.jsx)("h3",{className:"fw-medium",children:"What is JSON?"}),(0,r.jsxs)("p",{children:["JSON (JavaScript Object Notation) is a lightweight"," ",(0,r.jsx)("strong",{children:"data interchange format"}),". It is easy to read and write and easy to parse and generate using code.",(0,r.jsx)("br",{}),"It is based on a"," ",(0,r.jsx)("strong",{children:"subset of the JavaScript programming language"}),"."," "]}),(0,r.jsxs)("p",{children:["JSON is a ",(0,r.jsx)("strong",{children:"text format"})," that is completely language independent but uses conventions that are familiar to programmers of many languages like C, C++, C#, Java or JavaScript. These properties make JSON an ideal data-interchange language."]}),(0,r.jsx)("h3",{className:"mt-6 fw-medium",children:"JSON syntax"}),(0,r.jsx)("p",{children:"JSON is built on two universal data structures:"}),(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["A collection of ",(0,r.jsx)("strong",{children:"unordered name/value pairs"}),": usually called in other languages, object, record, struct, dictionary, hash table, keyed list, or associative array."]}),(0,r.jsxs)("li",{children:["An ",(0,r.jsx)("strong",{children:"ordered list of values"}),": called in other languages, array, vector, list, or sequence."]})]}),(0,r.jsx)("p",{children:"The JSON syntax is derived from the JavaScript object notation syntax:"}),(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Curly braces"})," hold ",(0,r.jsx)("strong",{children:"objects"})," ","name/value pairs"," ",(0,r.jsxs)("code",{className:"ms-2",children:["{","...","}"]})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Square brackets"})," hold ",(0,r.jsx)("strong",{children:"arrays"})," ",(0,r.jsx)("code",{className:"ms-2",children:"[...]"})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Object name/value pairs"})," are"," ",(0,r.jsx)("strong",{children:"separated by a colon"}),(0,r.jsx)("code",{className:"ms-2",children:'"name": "value"'})]}),(0,r.jsxs)("li",{children:["Object and array ",(0,r.jsx)("strong",{children:"members"})," are"," ",(0,r.jsx)("strong",{children:"separated by commas"})," ",(0,r.jsx)("code",{className:"ms-2",children:"[1,2,3]"})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Object names"})," are enclosed in"," ",(0,r.jsx)("strong",{children:"double quotes"})," ",(0,r.jsx)("code",{className:"ms-2",children:'"name"'})]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Object names"})," must be ",(0,r.jsx)("strong",{children:"unique"})," ","within the object"]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"String"})," values must be"," ",(0,r.jsx)("strong",{children:"enclosed in double quotes"})]}),(0,r.jsxs)("li",{children:["Values can be one of the following data types:",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["a string ",(0,r.jsx)("code",{className:"ms-2",children:'"value"'})]}),(0,r.jsxs)("li",{children:["a number",(0,r.jsx)("code",{className:"ms-2",children:"-5.56e7"})]}),(0,r.jsxs)("li",{children:["an object",(0,r.jsxs)("code",{className:"ms-2",children:["{","...","}"]})]}),(0,r.jsxs)("li",{children:["an array ",(0,r.jsx)("code",{className:"ms-2",children:"[...]"})]}),(0,r.jsxs)("li",{children:["a boolean ",(0,r.jsx)("code",{className:"ms-2",children:"true"})," or",(0,r.jsx)("code",{className:"ms-2",children:"false"})]}),(0,r.jsxs)("li",{children:["null",(0,r.jsx)("code",{className:"ms-2",children:"null"})]})]})]})]}),(0,r.jsx)("h3",{className:"mt-6 fw-medium",children:"Effects of JSON minification"}),(0,r.jsx)("p",{children:"Minification is the process of removing unnecessary characters from the source code without changing its functionality. JSON minification removes:"}),(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Spaces"}
26),": all spaces are removed from the JSON data including spaces preceding the colon and following the comma. This makes the JSON data more compact by removing all the indentation."]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Line breaks"}),": all line breaks are removed from the JSON data which is transformed into a single line."]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("strong",{children:"Tabs"}),": all tabs are removed from the JSON data."]})]})]})})})})]})}},40670:(e,s,n)=>{"use strict";function r(e,s){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==s.indexOf(r))continue;n[r]=e[r]}return n}n.d(s,{A:()=>r})},44501:(e,s,n)=>{"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}n.d(s,{A:()=>r})},59751:(e,s,n)=>{"use strict";n.d(s,{A:()=>t});var r=n(37876),a=n(20471);let t=function(){return(0,r.jsxs)(a.A,{colorScheme:"secondary",children:[(0,r.jsx)("h4",{className:"fw-medium",children:"\uD83D\uDCA1 This tool is provided for free by Mockoon!"}),(0,r.jsxs)("p",{children:["Mockoon is a ",(0,r.jsx)("strong",{children:"powerful API mocking tool"})," that makes it easy to ",(0,r.jsx)("strong",{children:"create and manage mock APIs"})," for prototyping and testing. With an intuitive interface, you can quickly set up mock servers, customize responses, and simulate scenarios in real-time,"," ",(0,r.jsx)("strong",{children:"enhancing team collaboration"})," and"," ",(0,r.jsx)("strong",{children:"speeding up development"}),"."]}),(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsxs)("a",{href:"/download/",className:"btn btn-primary-subtle btn-xs",children:[(0,r.jsx)("i",{className:"icon-file_download me-2"})," Download"]})})]})}},68478:(e,s,n)=>{"use strict";n.d(s,{E2:()=>h,kt:()=>d,l8:()=>o});var r=n(66376),a=n(70814),t=n(7808),l=n.n(t),i=n(81932),c=n.n(i);let o=(0,a.bu)((0,r.cp)(),{delay:100});function d(e,s){let n;return(n=e.message.match(/at position (\d+)/))?{position:Math.min(+n[1],s.length)}:(n=e.message.match(/at line (\d+) column (\d+)/))?{position:Math.min(s.line(+n[1]).from+ +n[2]-1,s.length)}:{position:1}}function h(){let e=new(l())({allErrors:!0});return c()(e),e}},85943:(e,s,n)=>{"use strict";n.d(s,{A:()=>c});var r=n(37876),a=n(70814),t=n(44547),l=n(81723),i=n(14232);let c=function({value:e,lang:s,showValidMsg:n,showErrors:c,editorExtensions:o,hideGoToLine:d,onErrorChange:h,onValueChange:m}){let[u,x]=(0,i.useState)(null),j=(0,i.useRef)(null);return c=c??!0,(0,r.jsxs)("div",{className:"d-flex flex-column h-100",children:[(0,r.jsx)(l.Ay,{theme:(0,t.KL)({settings:{fontFamily:'"Fira Code", Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace'}}),extensions:[l.Lz.lineWrapping,(0,a.pJ)(),...o],basicSetup:{lintKeymap:!1},height:"100%",style:{minHeight:"0"},className:"h-100",value:e,lang:s,ref:j,onChange:(e,s)=>{h&&x(h(e,s)),m&&m(e,s)}}),u&&c&&(0,r.jsxs)("div",{className:"bg-danger-subtle border-start border-danger border-4 p-4 mt-4 position-relative d-flex justify-content-between",children:[(0,r.jsx)("div",{style:{whiteSpace:"pre-wrap",fontFamily:'"Fira Code", Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace'},children:u.message}),!d&&(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("a",{href:"#",onClick:e=>{e.preventDefault(),(e=>{if(!j?.current?.state?.doc)return;let s=void 0!==e.position?e.position:j.current.view.state.doc.line(e.line+1).from+e.column;j.current.view?.dispatch({selection:l.OF.single(s,s),scrollIntoView:!0})})(u)},children:"Go to line"})})]}),!u&&n&&(0,r.jsx)("div",{className:"bg-success-subtle border-start border-success border-4 p-4 mt-4",children:(0,r.jsxs)("div",{children:[s.toUpperCase()," is valid!"]})})]})}},86328:(e,s,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/tools/json-minifier",function(){return n(24535)}])},89032:(e,s,n)=>{"use strict";n.d(s,{A:()=>i});var r=n(37876),a=n(66376),t=n(85943),l=n(68478);let i=function(e){return(0,r.jsx)(t.A,{lang:"json",editorExtensions:[(0,a.Pq)(),l.l8],onErrorChange:(e,s)=>{try{return JSON.parse(e),null}catch(e){return{message:e.message,...(0,l.kt)(e,s.state.doc)}}},...e})}}},e=>{e.O(0,[5366,6212,1325,1991,5753,9447,9299,636,6593,8792],()=>e(e.s=86328)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.