Giter Site home page Giter Site logo

react-code-editor's Introduction

JSX to JSON Converter App

This is a React application that allows you to convert JSX code into JSON format. It provides a user-friendly interface where you can input your JSX code, and the app will generate the corresponding JSON representation.

Features

  • Syntax highlighting: The code editor component uses Prism.js to provide syntax highlighting for both JSX and JSON code.
  • Real-time conversion: As you edit the JSX code, the JSON representation is updated in real-time, providing instant feedback.
  • Dual editor layout: The app displays two sets of editors side by side, allowing you to view and compare the JSX and JSON code simultaneously.

Prerequisites

To run the app locally, make sure you have the following dependencies installed:

  • React
  • react-simple-code-editor
  • prismjs

You can install these dependencies using npm or yarn by running the following command:

npm install react react-simple-code-editor prismjs

Getting Started

  1. Clone the repository and navigate to the project directory.

  2. Install the dependencies by running the following command:

npm install
  1. Start the development server:
npm start
  1. Open your browser and visit http://localhost:3000 to access the app.

Usage

  1. Upon opening the app, you'll see two sets of code editors, each with JSX and JSON code.

  2. Modify the JSX code in the left editor to reflect the component you want to convert.

  3. As you make changes, the JSON representation will update in real-time in the right editor.

  4. To initiate the conversion manually, click the "Convert" button below the JSX editor.

  5. The JSON representation will be displayed in the right editor.

  6. You can also modify the JSON code in the right editor, and the corresponding JSX code will update in real-time in the left editor.

  7. To convert the JSON back to JSX, click the "Convert" button below the JSON editor.

  8. Feel free to experiment with different JSX code and observe the resulting JSON and vice versa.

Additional Information

  • This app uses the react-simple-code-editor package for providing the code editor functionality.
  • The prismjs library is used for syntax highlighting in the code editors.
  • The conversion logic is implemented in the convertJSXToJSON function, which extracts information from the JSX code and generates a JSON representation.

Note: It's important to mention that the conversion process relies on certain assumptions about the structure and formatting of the JSX code. Make sure your JSX code follows the expected patterns for accurate conversion.

License

This project is licensed under the MIT License.

react-code-editor's People

Contributors

jhumeey avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.