Home / Function/ jsonStringify() — drizzle-orm Function Reference

jsonStringify() — drizzle-orm Function Reference

Architecture documentation for the jsonStringify() function in studio.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  649d9820_66d0_6975_1e12_72ca2dab5d5a["jsonStringify()"]
  82de12f8_a8ca_9d38_8da8_9ac945d81e01["studio.ts"]
  649d9820_66d0_6975_1e12_72ca2dab5d5a -->|defined in| 82de12f8_a8ca_9d38_8da8_9ac945d81e01
  2a2d384e_29cd_b901_fdda_e10fca96a027["prepareServer()"]
  2a2d384e_29cd_b901_fdda_e10fca96a027 -->|calls| 649d9820_66d0_6975_1e12_72ca2dab5d5a
  style 649d9820_66d0_6975_1e12_72ca2dab5d5a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/serializer/studio.ts lines 644–673

const jsonStringify = (data: any) => {
	return JSON.stringify(data, (_key, value) => {
		// Convert Error to object
		if (value instanceof Error) {
			return {
				error: value.message,
			};
		}

		// Convert BigInt to string
		if (typeof value === 'bigint') {
			return value.toString();
		}

		// Convert Buffer and ArrayBuffer to base64
		if (
			(value
				&& typeof value === 'object'
				&& 'type' in value
				&& 'data' in value
				&& value.type === 'Buffer')
			|| value instanceof ArrayBuffer
			|| value instanceof Buffer
		) {
			return Buffer.from(value).toString('base64');
		}

		return value;
	});
};

Domain

Subdomains

Called By

Frequently Asked Questions

What does jsonStringify() do?
jsonStringify() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/serializer/studio.ts.
Where is jsonStringify() defined?
jsonStringify() is defined in drizzle-kit/src/serializer/studio.ts at line 644.
What calls jsonStringify()?
jsonStringify() is called by 1 function(s): prepareServer.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free