@@ -114,11 +114,12 @@ const JsonEditorVue = defineComponent({
114114 const stringifiedComputed = computed ( ( ) => conclude ( [ props . stringified , propsGlobal . stringified , true ] , {
115115 type : Boolean as PropType < boolean > ,
116116 } ) )
117+ let parse = JSON . parse
117118 const onChange = debounce ( ( updatedContent : { json ?: any , text ?: string } ) => {
118119 preventUpdatingContent . value = true
119120 if ( ! stringifiedComputed . value && updatedContent . text ) {
120121 if ( jsonEditor . value && ! jsonEditor . value . validate ( ) ) {
121- updatedContent . json = JSON . parse ( updatedContent . text )
122+ updatedContent . json = parse ( updatedContent . text )
122123 }
123124 updatedContent . text = undefined
124125 }
@@ -173,6 +174,8 @@ const JsonEditorVue = defineComponent({
173174 } ,
174175 )
175176
177+ parse = initialAttrs . parser ?. parse || JSON . parse
178+
176179 jsonEditor . value = new JSONEditor ( {
177180 target : currentInstance ?. $refs . jsonEditorRef as Element ,
178181 props : initialAttrs ,
@@ -231,6 +234,7 @@ const JsonEditorVue = defineComponent({
231234 if ( newAttrs . onChangeMode || newAttrs [ 'on-change-mode' ] ) {
232235 defaultFunctionAttrs . onChangeMode = onChangeMode
233236 }
237+ parse = ( newAttrs . parser as JSON ) ?. parse || JSON . parse
234238 jsonEditor . value ?. updateProps (
235239 Object . getOwnPropertyNames ( defaultFunctionAttrs ) . length > 0
236240 ? conclude ( [ newAttrs , defaultFunctionAttrs ] , {
0 commit comments