PageSourceSearch

https://json-5.com/_next/static/chunks/779-7f1b7c9cd9e617c1.js

js json-5.com collected 2026-10-03 20:48:42 UTC 11,226 bytes, 18 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[779],{8791:()=>{},14925:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});var a=n(22174),o=n(65162);let r=function(){let[e,t]=(0,o.useState)(!1);return()=>{e||((0,a.wD)(),t(!0))}}},22174:(e,t,n)=>{"use strict";n.d(t,{C9:()=>s,r8:()=>r,wD:()=>i});var a,o=n(47805);n(33202);var r=((a={}).monacoLoadSuccess="monacoLoadSuccess",a.monacoLoadFail="monacoLoadFail",a);let s=e=>{try{if(o.A.isAdmin())return;window.__aemSendEvent(e),console.log("aemEvent",e)}catch(e){console.warn("aemEvent",e)}},i=async()=>{let e="AW-978306195/Sll4CIbA05wYEJOJv9ID";try{if(o.A.isAdmin())return;await o.A.sleep(3e3),window.gtag("event","conversion",{send_to:e}),console.log("aaa gtagReportConversion",e)}catch(e){console.error("gtagReportConversion",e)}}},40284:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var a=n(65162);let o=function(){return a.useMemo(()=>!0,[])}},75563:()=>{},78950:(e,t,n)=>{"use strict";n.d(t,{T:()=>K,A:()=>Q});var a,o,r=n(4930);n(75563);var s=n(25464),i=n.n(s),l=n(65162),c=n(77518),u=n.n(c),p=n(99579),d=n(4577),g=n.n(d),h=n(26980),m=n(45674),f=n(24641),j=n(71298),v=n(25784),y=n(32139),S=n(97847),A=n.n(S),x=n(37211),J=n.n(x);n(41200);var N=n(83356),b=n(47805),C=n(33202),w=n.n(C),O=n(49097),T=n.n(O),I=n(87422),k=n(87426),L=n(40284),$=n(34081),F=n(33147),P=n(85466),D=n(67197),M=n(80805),R=n(81394),_=n(14925);function E(e){return e.replace(/(^\s*)|(\s*$)/g,"")}let V={Date:"java.util.Date",List:"java.util.List"};function U(e){return e.replace(/\_(\w)/g,function(e,t){return t.toUpperCase()})}var B=n(87673),G=n(87124);let W=u()(()=>n.e(461).then(n.bind(n,37461)),{loadableGenerated:{webpack:()=>[37461]},ssr:!1,loading:()=>(0,r.jsx)("div",{children:"Loading editor..."})}),q="json-type.leftPaneFlex",z="json-type.inputText",X="json-type.targetProps",Y=`{
2  // We supports comment in JSON
3  "url": "https://json-5.com/json-to-typescript",
4  "description": "Generate TypeScript from JSON"
5}`,Z="com.company.pojo";var H=((a=H||{}).Unfold="Unfold",a.Fold="Fold",a),K=((o={}).TypeScript="TypeScript",o.Java="Java",o);let Q=e=>{let{notification:t}=h.A.useApp(),{defaultLanguage:a}=e,o=(0,l.useRef)(null),s=(0,l.useRef)(null),c=(0,l.useRef)(null),[u,d]=(0,l.useState)(!1),[S,x]=(0,p.A)("Fold","Unfold"),[C,O]=(0,p.A)(!1,!0);l.useMemo(()=>!("u">typeof navigator)||navigator?.userAgent?.includes("Macintosh"),[]);let H=(0,k.A)(),K=(0,L.A)(),Q=(0,P.I)(),ee=(0,_.A)(),[et]=m.A.useForm(),en=m.A.useWatch("language",et)||a,ea=(0,G.useRouter)();m.A.useWatch("options",et),(0,l.useEffect)(()=>{(async()=>{(await n.e(632).then(n.bind(n,38632))).default.config({paths:{vs:b.A.getMonacoEditorPath()}})})()},[]);let eo=w().debounce(e=>{localStorage.setItem(z,e)},500),er=e=>{o?.current?.editorInstance?.setValue(e)};(0,l.useEffect)(()=>{(async()=>{let e=localStorage.getItem(z),{options:t}=ei();if(et.setFieldValue("language",a),!t?.[a]){let e={};"Java"===a&&(e={package:Z}),(t=t||{})[a]=e}et.setFieldValue("options",t),await b.A.waitUntil(async()=>!!o.current&&!!s.current),er(e||Y),es()})()},[]);let es=w().debounce(async()=>{var e;let t,n=(0,M.eS)(o.current?.editorInstance);try{if(n){let e=T().parse(n);switch(et.getFieldsValue().language){case"TypeScript":t=i()(e).join("\n");break;case"Java":t=(function(e,t,n,a){let o=null;e=E(e);try{JSON.parse(e)}catch(e){}o="["===e[0]&&"]"===e[e.length-1]?JSON.parse(e='{ "list": '+e+"}").list[0]:JSON.parse(e);let r={},s=[];for(let e in o){let t=o[e],n=e;r[n=U(e)]=function e(t,n,a,o,r){var s,i;t&&t.replace&&(t=E(t));let l=typeof t;if("number"===l)if(t%1==0)return t<65536?"int":"long";else return"double";if("boolean"===l)return l;if("Invalid Date"!==new Date(t).toString())return"Date";if(!t||"string"===l)return"String";if(s=t,"[object Array]"===Object.prototype.toString.call(s)){let o=e(t[0],n,a);return"int"==o?o="Integer":"long"==o?o="Long":"float"==o?o="Float":"double"==o&&(o="Double"),"List<"+o+">"}{let s=(i=n)?i[0].toUpperCase()+i.substr(1):"",l={};for(n in t){let s=t[n],i=n;switch(o){case"1":i=U(n);break;case"2":i=n.replace(/([A-Z])/g,"_$1").toLowerCase(),r&&("2"===r?i=i.toUpperCase():"1"===r&&(i=i.toLowerCase()))}l[i]=e(s,i,a,o,r)}return a.push({name:s,val:l}),s}}(t,n,s,"1","1")}return t||(t="AtoolBean"),[r={name:t,val:r}].concat(s)}
5)(JSON.stringify(e),"RootClass",0,0).map((e,t)=>(function(e,t){let n=e.val,a=e.name,o="",r="",s="",i={},l=!1,c=`
6  public void setA(T a) {
7    this.a = a;
8  }
9  public T getA() {
10    return a;
11  }`;for(let e in n){e!=e&&(r+='  @JsonProperty("'+e+'")\n',l=!0),r+="  private "+n[e]+" "+e+";\n";let t=n[e];t.indexOf("List<")>-1&&(t=(t=n[e].replace("List<","")).replace(">",""),i.List="true"),i[t]="true";let a={a:e,A:e.substr(0,1).toUpperCase()+e.substr(1),T:n[e]};s+=c.replace(/a|A|T/g,function(e){return a[e]})}for(let e in i)V[e]&&(o+="import "+V[e]+";\n");return l&&(o+="import org.codehaus.jackson.annotate.JsonIgnoreProperties;\nimport org.codehaus.jackson.annotate.JsonProperty;"),t&&(o="package "+t+"; \n"+o),`/** 
12 * ${a}.java
13 */ 
14${o}
15public class ${a} {
16${r}${s}
17}
18`})(e,el("Java").package||Z)).join("\n")}}else t="";d(!1)}catch(e){d(!0),t=e.toString()}e=t,s?.current?.editorInstance?.setValue(e)},200),ei=()=>{let e=localStorage.getItem(X);try{return JSON.parse(e)||{}}catch(e){return{}}},el=e=>et?.getFieldsValue()?.options?.[e]||{};(0,$.A)("meta.b",e=>{O.toggle()});let ec=l.useMemo(()=>{if(!K)return .35;if(C)return 0;let e=parseFloat(window?.localStorage?.getItem(q))||.35;return e>.9?.9:e<.1?.1:e},[K&&window?.localStorage?.getItem(q),C]),eu=(0,r.jsxs)("div",{className:"editor-container placeholder",children:[(0,r.jsxs)("h1",{children:["Convert JSON to ",en," online.  ",(0,r.jsx)(I.A,{})]}),(0,r.jsxs)("p",{children:['"JSON to ',en,'" refers to the process of converting JSON data into ',en," code. JSON is a lightweight data interchange format, while ",en," is a programming language that adds features such as static typing and interfaces. "]}),(0,r.jsxs)("p",{children:["By transforming JSON data into ",en," code, developers can more easily work with the data in a ",en," project. The process of converting JSON to ",en," can be done using ",(0,r.jsx)("a",{href:"https://json-5.com",children:"json-5.com"})]})]}),ep=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(N.u$,{orientation:"vertical",className:"editor-container",children:[(0,r.jsxs)(N.LT,{flex:ec,className:"left-pane",onResize:e=>{let{flex:t}=e.component.props;window.localStorage.setItem(q,`${t} `)},children:[(0,r.jsx)(W,{defaultLanguage:"typescript",onMount:(e,t)=>{o.current={editorInstance:e,monacoInstance:t},e?.focus(),t.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0,noSuggestionDiagnostics:!0,onlyVisible:!0}),e.onDidChangeCursorPosition(()=>{c?.current?.computeJsonPath(e)})},options:{...D.C,lineNumbersMinChars:1},onChange:(e,t)=>
18{eo(e),es(),t?.isFlush||ee()}}),!Q&&(0,r.jsx)("div",{className:"editor-topbar left",children:(0,r.jsx)(f.Ay,{type:"link",onClick:()=>{er(""),eo("")},children:"Clear"})})]}),(0,r.jsx)(N.kT,{}),(0,r.jsxs)(N.LT,{name:"rightPane",children:[(0,r.jsx)(W,{defaultLanguage:"typescript",onMount:(e,t)=>{s.current={editorInstance:e,monacoInstance:t},e.onDidChangeCursorPosition(()=>{c?.current?.computeJsonPath(e)})},options:D.C,onChange:(e,t)=>{}}),(0,r.jsxs)("div",{className:g()({hidden:u||Q},"editor-topbar right"),children:[(0,r.jsx)("h3",{children:"Convert JSON to"}),(0,r.jsxs)(m.A,{form:et,layout:"vertical",className:"hash-form",onChange:()=>{let e,t;e=et.getFieldsValue(),(t=ei()).language=e.language,t.options=t.options||{},Object.assign(t.options,e.options),localStorage.setItem(X,JSON.stringify(t)),es()},children:[(0,r.jsx)(m.A.Item,{name:["language"],shouldUpdate:!0,children:(0,r.jsx)(j.Ay.Group,{className:"format-style-radio-group",size:"small",onChange:e=>{let t=e.target.value;ea.push({Java:"json-to-java",TypeScript:"json-to-typescript"}[t])},children:(0,r.jsxs)(v.A,{direction:"vertical",children:[(0,r.jsx)(j.Ay,{value:"TypeScript",children:"TypeScript"}),(0,r.jsx)(j.Ay,{value:"Java",children:"Java"})]})})}),"Java"===et.getFieldsValue().language&&(0,r.jsx)(m.A.Item,{name:["options","Java","package"],label:"Generated package name",children:(0,r.jsx)(y.A,{placeholder:Z,allowClear:!0})})]}),(0,r.jsx)(f.Ay,{className:"copy-btn",onClick:()=>{J()((0,M.eS)(s.current.editorInstance)),t.success({message:`${en} Code Copied.`})},children:"Copy Code"})]})]})]}),(0,r.jsx)(R.A,{ref:c})]});return(0,r.jsxs)("div",{className:g()("json-type-container"),children:[(0,r.jsxs)(A(),{children:[(0,r.jsxs)("title",{children:["JSON to ",en]}),(0,r.jsx)(F.A,{domain:"json-5.com",path:"Java"===en?"json-to-java":"json-to-typescript"}),"Java"===en&&(0,r.jsx)("meta",{name:"description",content:"Convert JSON to Java POJO classes. You can customize the class and package names, and choose which fields to include or exclude based on their data type or name."}),"TypeScript"===en&&(0,r.jsx)("meta",{name:"description",content:"Convert JSON to TypeScript Interface. Transform JSON to TypeScript (TS) and generate interface definitions in web dev. Easily convert JSON to TypeScript Types in web projects."})]}),(0,r.jsx)(B.Ay,{}),H?eu:ep]})}},80805:(e,t,n)=>{"use strict";n.d(t,{AX:()=>o,T_:()=>a,eS:()=>r});let a=e=>{let t=e?.getPosition(),n=e?.getModel();return n?.getLineContent(t?.lineNumber||1).trim()||""},o=e=>{let t=e?.getModel();return t?.getLinesContent()},r=e=>{let t=e?.getModel();return t?.getLinesContent()?.join("\n")}},81394:(e,t,n)=>{"use strict";n.d(t,{A:()=>h});var a=n(4930);n(8791);var o=n(65162),r=n(80805),s=n(47150);let i=["A-Z","\xc0-\xd6","\xd8-\xf6","\xf8-\xff"];var l=n(26980),c=n(58519),u=n(6185),p=n(37211),d=n.n(p),g=n(22824);let h=o.forwardRef((e,t)=>{let{notification:n}=l.A.useApp(),[p,h]=(0,o.useState)([]);return o.useImperativeHandle(t,()=>({computeJsonPath:e=>{var t;let n,a=e?.getPosition(),o=e?.getModel(),l=(0,r.AX)(e).join("\n"),c=o.getOffsetAt(a);h((t={useBracketNotation:!1,quote:"Double"},""===(n=s.g$(l,c)).path[n.path.length-1]&&n.path.pop(),n.path.map((e,n)=>{var a,o,r,s,l,c;let u,p,d;return a=e,o=0===n,r=t,Number.isInteger(a)?`[${a}]`:(s=a,u=i.join(""),!RegExp(`^[${u}_$]+[${u}_$0-9]*$`,"gi").test(s.toString())||r?.useBracketNotation)?(l=a,c=r,p=JSON.stringify(l),d='"',c?.quote==="Single"?d="'":c?.quote==="Double"&&(d='"'),p=p.replace(/^"|"$/g,d),`[${p}]`):o?a.toString():"."+a})))}})),(0,o.useMemo)(()=>{let e=[].concat((p||[]).map((e,t)=>(0,a.jsx)(c.A.Item,{children:e},t))),t=p?.join("");return(0,a.jsxs)("div",{className:"component-json-path",children:[(0,a.jsxs)("span",{className:"home",children:[(0,a.jsx)(g.A,{className:"mr-1"}),"JSON Path:"]}),(0,a.jsx)(c.A,{separator:">",children:e}),t&&(0,a.jsx)(u.A,{placement:"topLeft",title:(0,a.jsxs)(a.Fragment,{children:["Copy JSON Path: ",t]}),children:(0,a.jsx)("a",{className:"copy-path-btn",onClick:()=>{d()(t),n.success({message:"JSON path copied."})},children:"Copy JSON Path"})})]})},[p])})},85466:(e,t,n)=>{"use strict";n.d(t,{I:()=>r});var a=n(65162),o=n(64967);let r=()=>{let e=a.useRef(window.document.body),t=(0,o.A)(e);return!!t&&t.width<600}},87426:(e,t,n)=>{"use strict";n.d(t,{A:()=>
18o});var a=n(65162);let o=function(){let e=(0,a.useRef)(!0);return e.current?(e.current=!1,!0):e.current}},91677:()=>{}}]);

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.