Clear Filters
Clear Filters

Compare error : Invalid conversion : JSON string to JSON number

9 views (last 30 days)
Hi everyone,
I have a live script MLX which is stored in a GitLab repo. I'm concerned that inadvertent edits have caused file divergence between branches. I pulled down the MLX from the 2 different branches, intending to use Matlab Compare tool to investigate.
I get the following pop-up error, which I haven't been able to resolve --
Live Code Comparison : Invalid conversion : JSON string to JSON number
To my knowledge, there is no visible JSON code in this MLX. To be safe, I cleared all output and embedded images from both versions. I did leave the Table of Contents in place.
The 2 versions execute without errors. This seems to be a Compare-specific problem.
Can anyone please offer any suggestions for what this error message might constructively be trying to tell me?
This issue is a bummer for me as it will likely lead to a branch merging conflict that may not be easy to resolve.

Answers (1)

Gagan Agarwal
Gagan Agarwal on 29 Aug 2023
Hi Bradley Stiritz
I have successfully performed a comparison between the two live scripts without the presence of JSON Strings or JSON Numbers using the " visdiff(filename1, filename2) " command and using GUI tool and both the methods are yielding satisfactory results.
The error you are currently encountering is commonly observed in the following scenarios:
  1. Incorrect JSON format: The JSON file being compared does not adhere to the valid format for data representation.
  2. Encoding issues: JSON files should ideally be encoded in UTF-8. If the file is encoded differently, it can lead to problems during parsing or conversion processes.
However, since you mentioned that you are attempting to compare live scripts, it would be beneficial if you could provide the scripts you are working with. This will enable us to conduct a more comprehensive assessment of the issue at hand.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!