New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

format-json-utils

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

format-json-utils

format-json-utils

  • 1.0.5
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

format-json-utils

npm version license npm bundle size

format-json-utils 是一个用于在JavaScript中格式化JSON字符串的工具,它基于ES Modules (ESM) 语法实现。支持 Vue2、Vue3、React。。。

安装

使用npm安装:

npm install format-json-utils

使用yarn安装:

yarn add format-json-utils

使用示例 以下是一个简单的示例,演示如何在 JavaScript 项目中使用 format-json-utils 来格式化 JSON 数据:

import { formatJSON } from 'format-json-utils';

// 场景一
const jsonData = {name: 'John Doe',age: 30,email: 'john@example.com'}; 
// 场景二
// const jsonData = "{\"name\": \"John Doe\", \"age\": \"30\",\"email\": \'john@example.com\'}"; 

const formattedJSON = formatJSON(jsonData);
console.log(formattedJSON);
//{
//    "name":"John Doe",
//    "age":"30",
//    "email":"john@example.com"
//}

API 文档

formatJSON(jsonObj, errorCallBack): string

此函数接受一个 JSON 数据对象和一个可选的 error 回调函数,返回格式化后的 JSON 字符串。

许可证

本项目基于 MIT 许可证。有关更多信息,请参阅 LICENSE 文件。

联系方式

如果您有任何疑问、建议或问题,请在issues留言。

FAQs

Package last updated on 21 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc