Main Content

JSON Format

JavaScript® Object Notation format

JavaScript Object Notation (JSON) is a data interchange format based on the JavaScript programming language. In MATLAB®, you can decode and encode JSON-formatted text. You can also import data from a JSON file into MATLAB as a structure (since R2023b), dictionary (since R2024b), table (since R2026a), or timetable (since R2026a). You can write the contents of a structure, dictionary, table, or timetable to a JSON file.

Functions

expand all

jsondecodeDecode JSON-formatted text
jsonencodeCreate JSON-formatted text from structured MATLAB data
readstructCreate structure array from file
writestructWrite structure array to file
readdictionaryCreate dictionary from file (Since R2024b)
writedictionaryWrite dictionary to file (Since R2024b)
readtableCreate table from file
writetableWrite table to file
readtimetableCreate timetable from file
writetimetableWrite timetable to file
detectImportOptionsCreate import options based on file content
jsonImportOptionsImport options object for JSON files (Since R2026a)
getvaroptsGet variable import options
setvaroptsSet variable import options
setvartypeSet variable data types

Topics