https://github.com/xvezda/jowa
JavaScript Object notation for Web API
https://github.com/xvezda/jowa
javascript json web-api
Last synced: about 1 month ago
JSON representation
JavaScript Object notation for Web API
- Host: GitHub
- URL: https://github.com/xvezda/jowa
- Owner: Xvezda
- Created: 2024-04-01T22:39:21.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-03T09:19:40.000Z (about 1 year ago)
- Last Synced: 2025-02-05T20:06:51.530Z (3 months ago)
- Topics: javascript, json, web-api
- Language: JavaScript
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jowa
## What is it for?
It's a specification and also a library designed to express values that cannot be represented in JSON as valid JSON, and to assist in receiving and using them through Web APIs.
## Examples
`/api/patterns/greet`
```json
{
"type": "RegExp",
"args": ["hello,? (\\w+)", "i"]
}
``````ts
import { fromSchema } from 'jowa';const greetSchema = await fetch('/api/patterns/greet').then(r => r.json());
const greetRegex = fromSchema(greetSchema);console.log(greetRegex instanceof RegExp); // true
const [, userName] = 'Hello, Xvezda!'.match(greetRegex);
console.log(userName); // Xvezda
```