> For the complete documentation index, see [llms.txt](https://docs.justaname.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.justaname.id/sdk-reference/justaname-core-sdk/functions/sanitizetexts.md).

# sanitizeTexts

Converts text data from object or array format into a standardized array of text record objects.

***

## Usage

```typescript
import { sanitizeTexts } from '@justaname.id/sdk'

// Object format
const texts = sanitizeTexts({
  description: 'My personal description',
  url: 'https://example.com',
  email: 'contact@example.com'
})

console.log(texts)
// [
//   { key: 'description', value: 'My personal description' },
//   { key: 'url', value: 'https://example.com' },
//   { key: 'email', value: 'contact@example.com' }
// ]

// Array format (returns as-is)
const texts2 = sanitizeTexts([
  { key: 'description', value: 'My personal description' },
  { key: 'url', value: 'https://example.com' }
])
```

***

## Returns

`undefined` | [`TextRecord`](/sdk-reference/justaname-core-sdk/interfaces/textrecord.md)\[] - An array of text record objects with `key` and `value` properties, or undefined if no texts provided

## Parameters

* **texts**: `undefined` | `Record<string, string>` | [`TextRecord`](/sdk-reference/justaname-core-sdk/interfaces/textrecord.md)\[] - Text data in object or array format

## Defined in

[packages/@justaname.id/sdk/src/lib/utils/transformJsonToRecord/index.ts:3](https://github.com/JustaName-id/JustaName-sdk/blob/dc845c10af242e3ca87d95ef392516ac0bfa8b95/packages/@justaname.id/sdk/src/lib/utils/transformJsonToRecord/index.ts#L3)


---

# 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://docs.justaname.id/sdk-reference/justaname-core-sdk/functions/sanitizetexts.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.
