-
-
May 5, 2021 at 8:03 pm
graemebargen
SubscriberHello,
I have a specific .json file i would like to amend, specifically I would like to add a value to the end of a matrix (1 column, 20 rows) that is saved in the .json file. The name of the matrix is initial_params. Is there a short script that can be written to simply add one value to the end of the matrix (eg. to add a value to the 21st row)?
thanks
May 10, 2021 at 11:04 pmKyle
Ansys Employee
The simplest way to edit a JSON file would be to use a text editor. If you want to automate the process, the Lumerical scripting language has some commands for working with JSON files with specific formats:
What's the format of the JSON file? If it is a custom JSON file that isn't in the format used by the Lumerical scripting language I think you will have to use general string manipulation techniques, as in reading in the data from the text file with the read command, creating new strings, and adding them to the JSON file with the write command.
Viewing 1 reply thread- The topic ‘How to edit a .json file?’ is closed to new replies.
Innovation SpaceTrending discussionsTop Contributors-
5879
-
1906
-
1420
-
1306
-
1021
Top Rated Tags© 2026 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-
Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.