Giter Site home page Giter Site logo

Mutating JSON? about powerbi-vcs HOT 2 CLOSED

kimzander1 avatar kimzander1 commented on May 18, 2024
Mutating JSON?

from powerbi-vcs.

Comments (2)

kodonnell avatar kodonnell commented on May 18, 2024

Yup off topic = ) Seems like an issue with jsonpath-rw, as per that issue you linked. In normal python you'd just do something like the below (where I've probably got the exact json.load(s)/dump(s) syntax a little off). I.e. load json into an dictionary, mutate the dictionary then write it out.

d = json.load("./Report\\Layout")
d['some']['path']['to']['sections'][0] = {'fruit': 'apples'}
json.dump(d, "./Report\\Layout.new")

Note that doing

x = d['some']['path']['to']['sections'][0]
x = {'fruit': 'apples'}

won't mutate the dictionary.

from powerbi-vcs.

kimzander1 avatar kimzander1 commented on May 18, 2024

stilled by this...
Wow...python....
If code can be beautiful, this is.
thanks

from powerbi-vcs.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.