# HTML और JSON एक्सपोर्ट {#html-and-json}

Source: [React एडिटर से HTML और JSON एक्सपोर्ट करें · Yurich](https://leeyujoo.com/yurich/hi/features/html-and-json/)

Package: [`yurich`](https://www.npmjs.com/package/yurich)

Package version: `0.1.2`

एडिट करने योग्य HTML सेव करें और JSON पढ़ें।

## आज़माएँ {#try-it}

**एक्सपोर्ट** दबाएँ। कॉलबैक को HTML और `bold` मार्क वाला JSON मिलता है।

## एडिटर में जोड़ें {#setup}

फिर से खुलने वाले दस्तावेज़ के लिए `getHTML()` और स्ट्रक्चर्ड आउटपुट के लिए `getJSON()` इस्तेमाल करें।

```tsx
import {
  Bold, EditorContent, EditorProvider, useEditor, type DocumentJSON,
} from 'yurich';

export function ExportEditor({ onSave }: {
  onSave: (draft: { html: string; json: DocumentJSON }) => void;
}) {
  const editor = useEditor({
    extensions: [Bold],
    initialValue: "<p><strong>तैयार है</strong></p>",
  });

  return (
    <EditorProvider editor={editor}>
      <EditorContent ariaLabel="एडिटर" />
      <button type="button" onClick={() => onSave({
        html: editor.getHTML(),
        json: editor.getJSON(),
      })}>
        एक्सपोर्ट
      </button>
    </EditorProvider>
  );
}
```

## ध्यान देने योग्य व्यवहार {#behavior}

JSON में सीधे बदलाव न करें। लोड करने के लिए HTML इस्तेमाल करें। [HTML सेव और रिस्टोर करना](https://leeyujoo.com/yurich/hi/#save-and-restore-html) देखें।

[सुविधाएँ](https://leeyujoo.com/yurich/hi/features/)
