---
name: "Catmandu::Fix::import_from_string"
section: "3pm"
platform: "linux"
package: "libcatmandu-perl"
version: "1.2024-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Catmandu::Fix::import_from_string"
---

# Catmandu::Fix::import\_from\_string(3pm)

Import data from a string into an array ref, using a named importer.

## NAME

Catmandu::Fix::import\_from\_string - Import data from a string into an array ref, using a named importer.

## SYNOPSIS

```
    #BEFORE: { 'json' => '[{"name":"Nicolas"}]' }
    #AFTER:  { 'json' => [{"name":"Nicolas"}] }
    import_from_string('json','JSON')
    #BEFORE: { record => qq(first_name;name\nNicolas;Franck\nPatrick;Hochstenbach\n) }
    #AFTER:  { record => [{ "first_name" => "Nicolas",name => "Franck" },{ "first_name" => "Patrick",name => "Hochstenbach" }] }
    import_from_string('record','CSV', 'sep_char' => ';')
```

## DESCRIPTION

### import\_from\_string( PATH, NAME \[, IMPORT\_OPTIONS \] )

This fix uses the function import\_from\_string of the package Catmandu, but requires the NAME of the importer.

It always returns an array of hashes.

- PATH

  - NAME

  name of the importer to use. As usual in Catmandu, one can choose:

  \* full package name of the importer (e.g. 'Catmandu::Importer::JSON')

  \* short package name of the importer (e.g. 'JSON')

  \* name of the importer as declared in the Catmandu configuration

- IMPORT\_OPTIONS

  extra options for the named importer

## AUTHOR

Nicolas Franck, `"<nicolas.franck at ugent.be>"`

## SEE ALSO

Catmandu::Fix, Catmandu::Importer
