> For the complete documentation index, see [llms.txt](https://mflorin.gitbook.io/revivejs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mflorin.gitbook.io/revivejs/master.md).

# Introduction

[![Version](https://img.shields.io/npm/v/revivejs.svg)](https://npmjs.org/package/revivejs)[![License](https://img.shields.io/npm/l/revivejs)](https://github.com/mflorin/revivejs/blob/main/package.json)

ReviveJS is a Javascript deserializer library for reviving objects along with their prototype/behavior, based on a user defined schema.

Think about all the times you had to call an API, retrieve and parse the JSON response and then map that structure to your own models or build behavior around those structures.

ReviveJS simplifies this entire process by reviving entire chains of models in one shot.

{% tabs %}
{% tab title="TypeScript" %}

```typescript
import { revive } from 'revivejs'

class Person {
    name = ''
    public sayHi() {
        console.log(`Hi, I'm ${this.name}.`)
    }
}

const data = '{"name": "John Smith"}'
const person = revive(data, Person)
person.sayHi() // Hi, I'm John Smith.

```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const revivejs = require('revivejs')

function Person(name) {
    this.name = name
}
Person.prototype.sayHi = function() { console.log(`Hi, I'm ${this.name}.`) }

const data = '{"name": "John Smith"}'
const person = revivejs.revive(data, Person)
person.sayHi() // Hi, I'm John Smith.
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mflorin.gitbook.io/revivejs/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
