---
name: "JSON::Validator::URI"
section: "3pm"
platform: "linux"
package: "libjson-validator-perl"
version: "5.15+dfsg-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/JSON::Validator::URI"
---

# JSON::Validator::URI(3pm)

Uniform Resource Identifier

## NAME

JSON::Validator::URI - Uniform Resource Identifier

## SYNOPSIS

```
  use JSON::Validator::URI;
  my $urn = JSON::Validator::URI->new('urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f');
  my $url = JSON::Validator::URI->new('/foo');
  my $url = JSON::Validator::URI->new('https://mojolicious.org');
```

## DESCRIPTION

JSON::Validator::URI is a class for presenting both URL and URN.

This class is currently EXPERIMENTAL.

## EXPORTED FUNCTIONS

### uri

```
  $uri = uri;
  $uri = uri $orig, $base;
```

Returns a new JSON::Validator::URI object from `$orig` and `$base`. Both variables can be either a string or a JSON::Validator::URI object.

## ATTRIBUTES

JSON::Validator::URI inherits all attributes from Mojo::URL and implements the following ones.

### nid

```
  $str = $uri->nid;
```

Returns the NID part of a URN. Example "uuid" or "iban".

### nss

```
  $str = $uri->nss;
```

Returns the NSS part of a URN. Example "6e8bc430-9c3a-11d9-9669-0800200c9a66".

## METHODS

JSON::Validator::URI inherits all methods from Mojo::URL and implements the following ones.

### from\_data

```
  $str = $uri->from_data($data);
```

This method will generate a URN for `$data`. `$data` will be serialized using "encode\_json" in Mojo::JSON before being used to generate an UUIDv5.

This method is EXPERIMENTAL and subject to change!

### parse

See "parse" in Mojo::URL.

### to\_abs

See "to\_abs" in Mojo::URL.

### to\_string

See "to\_string" in Mojo::URL.

### to\_unsafe\_string

See "to\_unsafe\_string" in Mojo::URL.

## SEE ALSO

JSON::Validator.
