Skip to content

I2olanD/jtt.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jtt.nvim

A simple Neovim plugin to convert JSON to TypeScript interfaces.

Features

  • Converts JSON in current buffer to TypeScript interfaces
  • Handles nested objects, arrays and creates separate interfaces
  • Automatically copies result to system clipboard
  • Sorts properties alphabetically for consistency

Installation

Using lazy.nvim

  {
    "I2olanD/jtt.nvim",
    lazy = false,
    config = function()
      require('jtt').setup()
    end,
    keys = {
      { "<leader>jtt", "<cmd>JsonToTypeScript<cr>", desc = "Copy json to TS" }
    }
  }

Usage

  1. Open a JSON file in Neovim
  2. Run :JsonToTypeScript
  3. The TypeScript interfaces will be copied to your clipboard

Example

Input JSON:

{
  "user": {
    "id": 1,
    "name": "John"
  },
  "posts": [
    {
      "title": "Hello",
      "content": "World"
    }
  ]
}

Output TypeScript:

interface Posts {
  content: string;
  title: string;
}

interface User {
  id: number;
  name: string;
}

interface Root {
  posts: Posts[];
  user: User;
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages