Offset: 0.0s
Space Play/Pause

JSON: How I Build Perfect Images in NanoBanana Pro

Are you looking to gain precise control over your AI-generated images? There’s a powerful technique that can transform a creative but unpredictable AI model into a reliable, professional tool. This…

6 min read

Master AI Image Generation: The Power of JSON Prompting with Nano Banana Pro

Are you looking to gain precise control over your AI-generated images? There’s a powerful technique that can transform a creative but unpredictable AI model into a reliable, professional tool. This guide explores how using JSON prompting with Nano Banana Pro can revolutionize your workflow, giving you unprecedented control and consistency.

The Secret to Precise AI Outputs: JSON Prompting

[00:02.343] I’ve had incredible success using Nano Banana Pro with a technique called JSON prompting. You might be wondering what JSON is. Simply put, JSON (JavaScript Object Notation) is a computer language that defines parameters. By using it in my prompts, I’m giving the AI model a set of structured, machine-readable instructions. This adds a layer of clarity that helps the model generate exactly what I envision. To make this accessible for everyone, I’ve even created a translator that converts plain English descriptions into the necessary JSON format, so you don’t need to be a coder to use this powerful method.

“You can describe in plain English what you want, and the translator I wrote will render it right back into JSON, which will give Nano Banana a lot of structure.”

Is JSON a Universal Prompting Hack? Not Exactly.

[00:32.413] While powerful, it’s important to understand that JSON prompting isn’t a universal solution for every situation. This method of prompting specification shines when you have a clear and specific outcome in mind. It provides the structure needed to ensure the AI follows your instructions to the letter.

However, in many cases, the goal of using AI is to explore creative possibilities. We often want to leave room for the model to surprise us and generate something unexpected. In these scenarios, the rigid structure of JSON can be limiting and even counterproductive. It’s a myth that JSON is the only correct way to prompt AI models; they are trained on a vast array of languages and respond well to many different prompting styles.

“In so many cases with models, what we want is actually to leave the model room to be creative. JSON is actively bad in that situation.”

When to Use JSON for High-Stakes Results

[01:06.183] The real magic of JSON happens in high-stakes propositions where clarity and precision are paramount. For example, if you need a marketing image with very specific elements—like a particular brand of beverage, a model wearing specific clothing, and precise lighting conditions—a JSON prompt is the perfect tool. Similarly, if you are designing a user interface (UI) and need the colors and components to be exact, JSON provides the necessary control.

This is where Nano Banana Pro truly stands out. Unlike a “vibes machine” like Midjourney that excels at creative interpretation, Nano Banana Pro acts as a renderer. It is built for precision and thrives on correctness. JSON provides the clear, structured input that allows Nano Banana Pro to perform at its best, transforming it from a creative toy into a professional-grade tool.

“JSON gives it correctness. It gives it the clarity.”

Gaining Full Control with Compositional Control and Stable Handles

[01:58.383] One of the most powerful features of Nano Banana Pro, when combined with JSON, is its compositional control. JSON allows you to explicitly define every aspect of your creation, from camera angles and themes to layouts and notations. This creates stable handles for each important element in the image.

These handles allow you to isolate and modify specific parts of your design. You can define a subject that is distinct from its environment or a specific component within a UI. Once these handles are established in your JSON schema, you can instruct the model to regenerate only one part of the image without altering the rest. This process, known as a scoped mutation, gives you an incredible level of iterative control that isn’t possible with more generalized prompts.

From Photos to UI: Spanning Multiple Visual Grammars

[02:50.773] Nano Banana Pro is not limited to a single type of output; it spans multiple visual grammars, including photos, diagrams, and user interfaces. Each of these domains has its own set of core entities and rules, and JSON schemas help you define and switch between these grammars seamlessly.

This means you can use the same underlying principles to create a photorealistic marketing image, a complex technical diagram, or a polished UI design. The schema provides a structured blob with named fields, and Nano Banana Pro’s job is to honor those fields, whether it’s creating a photo, a diagram, or a UI. This ability to render with correctness across different domains makes it an incredibly versatile tool. With JSON, you can master all these domains and create professional-quality work, even in areas you’re not an expert in.

Turning a Toy into a Professional Tool

[03:55.773] Ultimately, schemas transform Nano Banana Pro from a fun toy into a serious professional instrument. For any serious product stack that involves design tools or code generation, you need three key things: reproducibility (getting the same result every time), diffability (seeing what changed between versions), and the ability to test prompts reliably.

JSON schemas offer all of this. You can version-control your JSON, track changes, and even encode rules for things like accessibility (e.g., ensuring a button’s tap target is at least 44 pixels). This makes the entire creative process governable and deterministic, a far cry from just typing a prompt and hoping for the best.

A Practical Walk-Through: From Messy Idea to Polished UI

[05:12.163] The workflow is straightforward. A user starts with a natural, messy idea, like “I need a mobile habit tracker app with a dark theme and three screens, with a feel like Notion meets Duolingo.” An LLM, guided by a specialized prompt, interprets this request and populates a detailed JSON schema with the necessary screens, components, and layout primitives. The user can then review and approve this schema before passing it to Nano Banana Pro for final rendering.

[07:08.307]

Here, I’ve given ChatGPT a simple instruction: “please respond with a filled-out JSON template that is for a very creative UI about aliens only respond with the json.” I provided an empty schema, and even with just a few tokens of direction, the AI gets to work.

[07:28.199]

The result is a fully populated JSON template. ChatGPT has creatively imagined what an “Alien Embassy Console” would look like and filled out all the necessary fields, from metadata to specific UI components. It even generated a preview image that is a faithful rendering of the JSON it created.

[08:09.130]

Next, I took this generated JSON and moved it over to Google AI Studio with Nano Banana Pro. To refine the output, I added a simple instruction at the top: “please faithfully follow this JSON to produce a high-grade professional buildable wireframe of this design.” This tells the model to focus on a clean, professional wireframe rather than a stylized image.

[08:35.952]

The final output is a perfect, high-fidelity wireframe that is completely reproducible. It’s an exact visual representation of the JSON data, demonstrating the power of this structured approach. By using JSON, I can achieve consistent, professional results and make precise adjustments by simply modifying the code.

By embracing JSON as a tool, you can unlock a new level of precision and control with Nano Banana Pro, turning your creative visions into professional-grade realities, whether you’re designing marketing photos, user interfaces, or complex diagrams.