![]() uJson makes it both simple and easy to work with JSON, so you can spend less time thinking about JSON and more time on things which are actually important to you: your business logic, application, and product. With uJson, you have a JSON library that does what you want to do, rather than forcing you to learn how to library wants to do things. Js.Obj("myFieldA" -> 2, "myFieldB" -> "k")Īnd trivial structures are trivial to construct: val nums = Js.Arr(1, 2, 3)ĭue to uJson's mutable data model, you probably already know how to modify any of the structures above, including modifying values nested in arrays and dictionaries: nested(0)("myFieldA") = 123 Nested structures are constructed similarly: val nested = Js.Arr( Here's an example constructing a JSON dictionary ( Js.Obj) from the Ammonite codebase: import ujson._ obj for casting to other common JSON types.Ĭonstructing JSON values using uJson is also simple, using the Js.* constructors. ![]() This is simply a property of working in a statically-typed language: it's effectively a cast to say "this JSON value is a String" to allow you to work with it as a String. using ("name") instead of for dictionary lookup), the only additional syntax here is the. With uJson, manipulating JSON should be just as simple and familiar regardless of what your programming background is: val data = ujson.read(input)Īpart from the minor syntactic differences from Python/Ruby/Javascript (e.g. In most languages, such as Python, Ruby or Javascript, it is trivial: Python import jsonĭata = data.split("").reverse().join("")Įach of the above examples is trivial even a beginner learning Python, Ruby or Javascript would have no problem understanding what each one is doing! A trivial code snippet is a fitting way of implementing a trivial task. to reverse the string, would seem like a trivial operation that should have a trivial solution. However, none of them achieve the heights of intuitiveness that someone coming from Python, Ruby or Javascript might expect working with JSON data types. Mikołaj is also a contributor into open source, and author of several utility and wrapper libraries (travesty, helisa).There are a lot of existing JSON libraries in Scala: Circe, Argonaut, Play-Json, and many others. He's convinced that taking lazy shortcuts backfires on a programmer sooner or later, and is committed to doing things “the right way”. So, what it is it exactly, and how can it make programming on the JVM an easier job for yourself?Ĭurrently at SoftwareMill, Mikołaj is an enthusiast of multi-paradigm coding, a firm believer in using the right tool for the job, and an occasional perambulatory Wikipedia mirror. Scala 3/Dotty is relatively close to being released, most of its features are already determined. Scala for the People (again)! Simpler coding with Scala 3/Dotty Any ideas or insights usually end up with a blog (). I have been a speaker at major conferences, such as JavaOne, LambdaConf, Devoxx and ScalaDays.Īpart from writing closed- and open-source software, in my free time I try to read the Internet on various (functional) programming-related subjects. ![]() I am involved in open-source projects, such as sttp, tapir, Quicklens, ElasticMQ and others. I am one of the co-founders of SoftwareMill, where I code mainly using Scala and other interesting technologies. We'll be focusing on one specific problem area, however the techniques that we'll use have broader applicability, and are often used to solve other problems as well. Is it also applicable to such daily programming tasks as accessing a relational database? Is it possible to work with transactions in a "functional" way? Yes! But what does it mean in practice? And is this any better than using JPA's or Spring's this live-coding session, we'll try to answer these questions, and demonstrate how the "functional" approach improves over the "traditional" one in three areas: working with multi-thread code, requiring a framework and precisely delimiting transaction boundaries. ![]() Functional programming is an increasingly popular approach to writing and thinking about code. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |