Перейти до змісту

Supporting Any String Configuration Format

Joystick can support and handle any type of configuration content. We natively support JSON with many powerful features including validation, ab testing, and schema protection. However, we also support any string format configuration including XML, YAML, INI, plain text. Over the API the configuration will returned to you as a serialized string.

Create a String Config

Selecting the String Config Option

When creating a config, select the "Wrapped String" option next to the "Save" button.

Info

  • You cannot change the config type after you have created it.
  • There is no validation or schema support when using a string config.

Adding a String Config

Input any string you want and save. This can be any format: JSON, XML, YAML, INI, plain text, or anything else.

Managing Your Config

Editing a String Config

Use our automated version management, editing, diffing, multiple environment, permissions, webhooks features of Joystick with your team to manage your configuration.

Getting The Config

When you get a wrapped string config over the Joystick Config API, it will be wrapped in a JSON object with one key named: string. The string will be serialized. To use it, you will need to deserialize it.

API Response: Configuration Only
{
  "string": "[YOUR CONFIG STRING SERIALIZED]",
}
API Response: With Joystick Dynamic Metadata
{
  "data": {
    "string": "[YOUR CONFIG STRING SERIALIZED]",
  }
  ...rest of Joystick dynamic metadata
}

Postman Example

Usage Example

JavaScript Example
// Import the package.
import { Joystick } from "@getjoystick/joystick-js";

// Initialize a client with a Joystick API Key
const joystickClient = new Joystick({
  apiKey: process.env.JOYSTICK_API_KEY,
});

// Get the config
const myConfig = joystickClient.getContent("my-string-config");
// Our Javascript SDK already runs JSON.parse, so will deserialize the string for you.
console.log(myConfig.string);

Detailed information about our RESTful configuration API: API Reference.