---
title: 'Quick Start'
description: "Get started quickly with JSONEval-Rs in your preferred language and environment."
navigation:
  icon: 'i-ph-lightning'
seo:
  title: 'Quick Start'
  description: "Get started quickly with JSONEval-Rs in your preferred language and environment."
---

Let's build a simple evaluation. We'll write a rule to check if someone is over 18, and evaluate it against data where the age is 25.

### Rust

```rust
use json_eval_rs::JSONEval;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // 1. Define your schema using JSON Schema format with logic blocks
    let schema = r#"{
        "type": "object",
        "properties": {
            "age": {
                "rules": {
                    "minValue": { "value": 18, "message": "Must be 18 or older" }
                }
            }
        }
    }"#;

    // 2. Initialize the evaluator tool (compiles the schema logic)
    let mut eval = JSONEval::new(schema, None, None)?;
    
    // 3. Define the data source
    let data = r#"{"age": 25}"#;

    // 4. Evaluate the data
    eval.evaluate(data, None, None)?;

    // 5. Validate rules and check for errors
    let validation = eval.validate(data, None, None)?;
    if !validation.has_error {
        println!("✅ Data is valid!");
    } else {
        println!("❌ Validation errors: {:?}", validation.errors);
    }

    Ok(())
}
```

### C#

```csharp
using JsonEvalRs;
using System;

class Program {
    static void Main() {
        var schema = @"{
            ""type"": ""object"",
            ""properties"": {
                ""age"": {
                    ""rules"": {
                        ""minValue"": { ""value"": 18, ""message"": ""Must be 18 or older"" }
                    }
                }
            }
        }";

        // Wrap JSONEval within a using block to discard memory cleanly
        using (var eval = new JSONEval(schema)) {
            var data = @"{""age"": 25}";
            
            // Execute the evaluation
            eval.Evaluate(data);
            
            // Get validation statuses
            var validation = eval.Validate(data);

            if (!validation.HasError) {
                Console.WriteLine("✅ Data is valid!");
            }
        }
    }
}
```

### React Native

```typescript
import React, { useState } from 'react';
import { View, Text, TextInput } from 'react-native';
import { useJSONEval } from '@json-eval-rs/react-native';

const schema = {
  type: 'object',
  properties: {
    age: {
      rules: {
        minValue: { value: 18, message: 'You must be 18 or older' }
      }
    }
  }
};

export default function AgeValidator() {
  const [age, setAge] = useState('');
  const [errorMsg, setErrorMsg] = useState('');
  
  // Initialize evaluator
  const evalInstance = useJSONEval({ schema });

  const handleChange = async (text: string) => {
    setAge(text);

    if (evalInstance) {
      const data = { age: parseInt(text, 10) || 0 };
      const validation = await evalInstance.validate({ 
        data: JSON.stringify(data) 
      });
      
      setErrorMsg(validation.has_error ? validation.errors.age?.message : '');
    }
  };

  return (
    <View>
      <TextInput 
        value={age}
        onChangeText={handleChange}
        keyboardType="numeric"
        placeholder="Enter your age"
      />
      {errorMsg ? <Text style={{color: 'red'}}>{errorMsg}</Text> : null}
    </View>
  );
}
```

### Web (Node.js)

For backend JavaScript environments using Node.js, use the `@json-eval-rs/node` package. It loads the native bindings automatically.

```typescript
import { JSONEval } from '@json-eval-rs/webcore';
import '@json-eval-rs/node';

async function run() {
    const schema = {
      type: "object",
      properties: {
        age: {
          rules: {
            minValue: { value: 18, message: "Must be 18 or older" }
          }
        }
      }
    };

    // 1. Initialize logic evaluator
    const evalInstance = new JSONEval({
      schema: JSON.stringify(schema)
    });

    const data = { age: 25 };

    try {
      // 2. Run validations across logic statements
      const validation = await evalInstance.validate({ 
        data: JSON.stringify(data) 
      });

      if (!validation.has_error) {
          console.log("✅ Data is valid!");
      }
    } finally {
      // 3. Make sure to free memory when done!
      evalInstance.free();
    }
}

run();
```

### Web (Bundler)

When using a bundler like Vite, Webpack, or full frameworks like Next.js/NuxtJS, supply the WebAssembly module on initialization:

```typescript
import { JSONEval } from '@json-eval-rs/webcore';
import * as wasmModule from '@json-eval-rs/bundler';

async function run() {
    // ... same schema and data ...
    const schema = { /* ... */ };
    const data = { age: 25 };

    const evalInstance = new JSONEval({
      schema: JSON.stringify(schema),
      wasmModule
    });

    try {
      const validation = await evalInstance.validate({ data: JSON.stringify(data) });
      if (!validation.has_error) console.log("✅ Data is valid!");
    } finally {
      evalInstance.free();
    }
}

run();
```

### Web (Vanilla JS)

For plain HTML or JS files without a bundler, use standard ES modules from the `@json-eval-rs/vanilla` package:

```typescript
import { JSONEval } from '@json-eval-rs/webcore';
import * as wasmModule from '@json-eval-rs/vanilla';

async function run() {
    // Initialization is identical to the bundler approach:
    const evalInstance = new JSONEval({ schema: JSON.stringify(schema), wasmModule });
    // ...
}
```

---

## Framework-specific guides

If you are writing a web application, read our dedicated integration instructions:

- **[Next.js](/how-to/use-nextjs)**
- **[NuxtJS](/how-to/use-nuxtjs)**
- **[React](/how-to/use-react)**
- **[Static HTML](/how-to/use-static-html)**

---

## Next steps

You've run your first evaluation. Here's what to look at next:

- Learn how to optimize evaluations via the **[Selective Evaluation](/advance-guide/optimize-selective-evaluation)** guide.
- Review the **[Operators Reference](/operators/summary)** to see the 80+ supported logic operators.
- Read about internal structures like the **[Compiled Logic Store](/advance-guide/compiled-logic-store)**.
