Skip to content

Commit 790b249

Browse files
committed
Json
1 parent 87bac31 commit 790b249

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Json.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ class Json extends Component {
3131
const { valueType, onChange } = this.props
3232

3333
try {
34-
value = JSON.parse(value)
35-
if (valueType === 'string') value = JSON.stringify(value, null, 4)
34+
if (value) {
35+
value = JSON.parse(value)
36+
if (valueType === 'string') value = JSON.stringify(value, null, 4)
37+
}
3638
onChange(value)
3739
} catch (e) {
3840
onChange(new Error(format(getLang('validation.tips.json'), '')))

0 commit comments

Comments
 (0)