ascii-json

WebJar for ascii-json

Лицензия

Лицензия

BSD
Категории

Категории

JSON Данные
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

ascii-json
Последняя версия

Последняя версия

0.2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

ascii-json
WebJar for ascii-json
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/donpark/ascii-json

Скачать ascii-json

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/ascii-json/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>ascii-json</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/ascii-json/
implementation 'org.webjars.npm:ascii-json:0.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/ascii-json/
implementation ("org.webjars.npm:ascii-json:0.2.0")
'org.webjars.npm:ascii-json:jar:0.2.0'
<dependency org="org.webjars.npm" name="ascii-json" rev="0.2.0">
  <artifact name="ascii-json" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='ascii-json', version='0.2.0')
)
libraryDependencies += "org.webjars.npm" % "ascii-json" % "0.2.0"
[org.webjars.npm/ascii-json "0.2.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

Generates ASCII-only JSON with escaped non-ASCII chracters.

Why

I wrote this to send UTF-8 JSON data as HTTP 1.x header value which can only use ISO-8859-1 characters.

BASE-64 could've been used but result wouldn't be as readable.

Install

    npm install ascii-json

Examples

    var asciiJSON = require('ascii-json');

See if a string is all ASCII or not

    asciiJSON.isAscii("this is all ASCII"); // true
    asciiJSON.isAscii("this is not 에스키"); // false

Escape non-ASCII strings

    console.log(asciiJSON.escapeNonAsciis('this is not 에스키'));

    // output: this is not \uc5d0\uc2a4\ud0a4"

Stringify object with non-ASCII property value

    troublemaker = {
      ascii: "hello world",
      nonascii: "안녕하세요"
    };
    asciiOnly = asciiJSON.stringify(troublemaker);
    console.log(asciiOnly);

    // output: {"ascii":"hello world","nonascii":"\uc548\ub155\ud558\uc138\uc694"}

Версии библиотеки

Версия
0.2.0