LaraDumps
  • What is LaraDumps?
  • Get Started
    • Installation
    • Configuration
  • Commands
    • Simple
    • Color
    • Log Application
    • Show queries
    • Clear History
    • Custom Label
    • JSON Validate
    • Contains
    • Table
    • Screens
    • Diff
    • Model
  • Reference
    • Livewire
  • App
    • Host
    • IDE
Powered by GitBook
On this page
  1. Commands

JSON Validate

PreviousCustom LabelNextContains

Last updated 2 years ago

You can check if a json is valid or not

Sometimes you may need to inspect and validate JSON strings coming from APIs or Front-end applications. Using the method isJson() will output if your string is a valid json.

$movies = Http::get('https://api.tvmaze.com/search/people?q=lauren');
        
ds($movies->body())->isJson()
    ->label('Valid JSON');

ds('{"}')->isJson()
    ->label('Invalid JSON');
JSON Validate