<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
Hi Katy,
<div><br>
</div>
<div>I think that in principle it should be possible to load in the data using ft_preprocessing(cfg), provided your data is properly BIDS formatted. Does the data pass the BIDS validator?</div>
<div><br>
</div>
<div>Something like: </div>
<div><br>
</div>
<div>cfg = [];</div>
<div>cfg.dataset = ’sub-something_task-somethingelse_etc.tsv’;</div>
<div>data = ft_preprocessing(cfg);</div>
<div><br>
</div>
<div>The error you get seems to be related to a low level json-file parsing issue, which suggests either that the json file(s) are incompatible with the code that is reading the json file, or that the code that reads the json file is buggy. </div>
<div><br>
</div>
<div>To distinguish between the two possibilities, I would start by trying to read in the *.json file in another way (i.e. using some software different than matlab). If that also throws an error (or if the BIDS validation fails), it’s probably an issue with
 the formatting of the json file.</div>
<div><br>
</div>
<div>I never work with this type of data myself, so I cannot comment any further on this. Perhaps anyone else can chime in?</div>
<div><br>
</div>
<div>BW,</div>
<div>JM</div>
<div><br id="lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On 11 Aug 2025, at 18:02, Cross, Kathryn A. via fieldtrip <fieldtrip@science.ru.nl> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">I am trying to load BIDS formatted motion data and am  unsure of the correct way to do this.<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">When I try to use ft_read_data I am receiving the below error.<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">Is my input wrong? It seems to be trying to read a tsv file as a json in line 317 of ft_read_header. I have tried a few variations of headerformat and
 dataformat arguments without success.<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">Thank you in advance for any advice!<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">Katy<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">data = ft_read_data(‘sub-CM01_task-reaching_tracksys-apdm_run-1_motion.tsv’,’dataformat’,’bids_tsv’);<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">208 [filename, headerfile, datafile] = dataset2files(filename, dataformat);<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">found matching BIDS sidecar 'G:\PROJECTS\Cueing_Noninvasive\data\bids\sub-CM01\motion\sub-CM01_task-reaching_tracksys-apdm_run-1_motion.tsv'<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">reading 'G:\PROJECTS\Cueing_Noninvasive\data\bids\sub-CM01\motion\sub-CM01_task-reaching_tracksys-apdm_run-1_motion.tsv'<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">Error using loadjson>error_pos<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">JSONLAB:JSON:InvalidFormat: Outer level structure must be an object or an array: 3<error><o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">Error in loadjson (line 143)<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">                pos=error_pos('Outer level structure must be an object or an array',inputstr,pos);<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">Error in ft_read_json (line 45)<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">  json = loadjson(filename);<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">Error in ft_read_header (line 317)<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">      data_json = ft_read_json(sidecar);<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">Error in ft_read_data (line 223)<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">  hdr = ft_read_header(filename, 'headerformat', headerformat, 'checkmaxfilter', checkmaxfilter, 'password', password, 'cache', cache);<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
</div>
<br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<hr style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<font face="Arial" color="Navy" size="2" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br>
UCLA HEALTH SCIENCES IMPORTANT WARNING: This email (and any attachments) is only intended for the use of the person or entity to which it is addressed, and may contain information that is privileged and confidential. You, the recipient, are obligated to maintain
 it in a safe, secure and confidential manner. Unauthorized redisclosure or failure to maintain confidentiality may subject you to federal and state penalties. If you are not the intended recipient, please immediately notify us by return email, and delete this
 message from your computer.<br>
</font><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">fieldtrip
 mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Ce2c671dc5df9468514ec08ddd8f3af9a%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638905263307062216%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=HSKT48AuKzLAEhYqdEn6XJzigAzeC%2BucSRmUUefq7jQ%3D&reserved=0" originalsrc="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Ce2c671dc5df9468514ec08ddd8f3af9a%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638905263307094926%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Yf6%2Bsd%2FYaWsHV1%2BEvrKtYGyZ6GTCXEI%2FYiu0wjwpVQM%3D&reserved=0" originalsrc="https://doi.org/10.1371/journal.pcbi.1002202" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">https://doi.org/10.1371/journal.pcbi.1002202</a></div>
</blockquote>
</div>
<br>
</div>
</body>
</html>