<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Riya Sharma🌸</title>
    <description>The latest articles on DEV Community by Riya Sharma🌸 (@riyasharma028).</description>
    <link>https://dev.to/riyasharma028</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1859478%2F699a9d99-53a2-4094-86c2-c1588d65929f.jpg</url>
      <title>DEV Community: Riya Sharma🌸</title>
      <link>https://dev.to/riyasharma028</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/riyasharma028"/>
    <language>en</language>
    <item>
      <title>Git &amp; GitHub</title>
      <dc:creator>Riya Sharma🌸</dc:creator>
      <pubDate>Thu, 02 Jan 2025 08:10:07 +0000</pubDate>
      <link>https://dev.to/riyasharma028/git-github-44l0</link>
      <guid>https://dev.to/riyasharma028/git-github-44l0</guid>
      <description>&lt;p&gt;Imagine you’re building your project—a beautiful portfolio website. After spending hours working on it, you accidentally save over an important file. This means the original content is replaced with the new one, and you can’t remember what was in it. Panic sets in.&lt;/p&gt;

&lt;p&gt;Now, imagine the chaos if you and a friend unknowingly work on the same file. You make changes, and they make different changes at the same time. When you both save your versions, it creates a mix of changes that is hard to manage and causes a lot of confusion. Does that sound familiar?&lt;/p&gt;

&lt;p&gt;This is a problem every developer faces at some point, and it’s precisely why Git and GitHub exist. They bring structure, safety, and collaboration to the chaotic world of coding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem Without Git and GitHub&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Scenario: Building a Website with a Friend&lt;/p&gt;

&lt;p&gt;You Start the Project:&lt;br&gt;
You create a file index.html with some basic content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html&amp;gt;
   &amp;lt;head&amp;gt;
      &amp;lt;title&amp;gt;My Website&amp;lt;/title&amp;gt;
   &amp;lt;/head&amp;gt;
   &amp;lt;body&amp;gt;
      &amp;lt;h1&amp;gt;Welcome to My Website&amp;lt;/h1&amp;gt;
   &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You send the file to your friend Alex via email.&lt;/p&gt;

&lt;p&gt;Alex Makes Changes:&lt;/p&gt;

&lt;p&gt;Alex receives the file and decides to add a footer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;body&amp;gt;
   &amp;lt;h1&amp;gt;Welcome to My Website&amp;lt;/h1&amp;gt;
   &amp;lt;footer&amp;gt;© 2025 My Website&amp;lt;/footer&amp;gt;
&amp;lt;/body&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alex emails it back to you.&lt;/p&gt;

&lt;p&gt;You Make Changes Too:&lt;/p&gt;

&lt;p&gt;While Alex was working on the footer, you were adding a navigation bar:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;body&amp;gt;
   &amp;lt;nav&amp;gt;Home | About | Contact&amp;lt;/nav&amp;gt;
   &amp;lt;h1&amp;gt;Welcome to My Website&amp;lt;/h1&amp;gt;
&amp;lt;/body&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Collision Happens:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You receive Alex’s version and open the file. When you save your version with the navigation bar, Alex’s footer gets overwritten. Now you have to manually merge the changes, which can be error-prone and time-consuming.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Confusion :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As you continue to collaborate, more files pile up with confusing names like index.html, index_final.html, and index_final_final.html. It becomes impossible to track who did what, and fixing errors takes longer than writing code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Solution: Git and GitHub&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Is Git?&lt;/strong&gt;&lt;br&gt;
Git is a version control system that acts like a time machine for your project. Here’s how it solves the problem:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tracks Every Change:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git records every modification you make, so nothing is ever lost.&lt;/li&gt;
&lt;li&gt;Instead of creating index_v1.html, Git automatically tracks versions of your file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Undo Mistakes Instantly:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If Alex overwrites your navigation bar, Git lets you roll back to the version where it still exists.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Experiment Safely:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Want to try a new feature? Git lets you create a separate branch where you can test changes without affecting the main project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Is GitHub?&lt;/strong&gt;&lt;br&gt;
GitHub is a cloud-based platform that takes Git to the next level. Here’s how it fixes collaboration confusion:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One Centralized Repository&lt;/strong&gt; (a storage space for your project):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You and Alex upload the project to GitHub.&lt;/li&gt;
&lt;li&gt;Both of you work on the same repository, so there’s no need to email files back and forth.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Branching for Parallel Work&lt;/strong&gt; (creating separate versions of the project to work on different features):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can work on the navigation bar in one branch, while Alex works on the footer in another branch.&lt;/li&gt;
&lt;li&gt;Branches allow you to work on different features or bug fixes simultaneously without interfering with the main project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Merging Without Overwriting:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you’re both done, GitHub helps merge your changes into the main project.&lt;/li&gt;
&lt;li&gt;If there’s a conflict (like editing the same line), GitHub highlights it so you can resolve it together. This prevents accidental overwrites and ensures both contributions are included.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How Git and GitHub Work Together&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git tracks and manages your code locally on your computer.&lt;/li&gt;
&lt;li&gt;GitHub stores your code in the cloud and makes collaboration seamless.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Together, they:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep every version of your code safe.&lt;/li&gt;
&lt;li&gt;Prevent accidental overwrites.&lt;/li&gt;
&lt;li&gt;Make teamwork smooth and efficient.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Conclusion: Why Developers Need Git and GitHub&lt;br&gt;
The frustration of overwritten files, lost changes, and messy file versions is a thing of the past with Git and GitHub. These tools give you the power to manage code like a pro, whether working solo or with a team.&lt;/p&gt;

&lt;p&gt;In the next post, we’ll understand how to setup Git and GitHub to get started on first project. Stay tuned!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>git</category>
      <category>github</category>
    </item>
    <item>
      <title>The Role of JSON in APIs</title>
      <dc:creator>Riya Sharma🌸</dc:creator>
      <pubDate>Mon, 18 Nov 2024 13:00:40 +0000</pubDate>
      <link>https://dev.to/riyasharma028/the-role-of-json-in-apis-4f43</link>
      <guid>https://dev.to/riyasharma028/the-role-of-json-in-apis-4f43</guid>
      <description>&lt;p&gt;It’s easy to think of JSON as simply a part of JavaScript. Its syntax looks similar to JavaScript objects, But here’s the truth: JSON (JavaScript Object Notation) is not tied to JavaScript. It’s a lightweight, &lt;strong&gt;language-independent format&lt;/strong&gt; used globally for storing and exchanging data.&lt;/p&gt;

&lt;p&gt;So, Let me make things clear to you, let's move on to understand JSON&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What Does JSON Stand For?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;JSON stands for JavaScript Object Notation. It is a text-based format for representing structured data based on key-value pairs.&lt;/p&gt;

&lt;p&gt;As I mention above, JSON is a lightweight, text-based format used for storing and exchanging data. It is structured in a way that’s easy for both humans to read and machines to parse (interpret and convert into usable data). At its core, JSON is a collection of &lt;strong&gt;key-value pairs&lt;/strong&gt;, where each key is associated with a value. These pairs are used to represent data, such as user information, product details, or any other kind of structured data. A key is always a string, while the value can be a variety of data types such as strings, numbers, booleans, arrays, or even nested objects.&lt;/p&gt;

&lt;p&gt;Example of JSON structure:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frhotqaxizpoto7uhutc0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frhotqaxizpoto7uhutc0.png" alt="Image description" width="800" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the example above:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"name", "age", "isStudent", and "address" are the keys.&lt;/li&gt;
&lt;li&gt;"John", 30, false, and the object { "street": "123 Main St", "city": "Anytown" } are the values.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  So, Where is JSON Used?
&lt;/h2&gt;

&lt;p&gt;You might ask, "Where exactly is JSON used?" The answer is in APIs (Application Programming Interfaces).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is an API?&lt;/strong&gt;&lt;br&gt;
Before diving into how JSON works in APIs, let’s first understand what an API is.&lt;/p&gt;

&lt;p&gt;To put it simply, an API (Application Programming Interface) is a set of rules that lets different software applications communicate with each other. Think of it like a waiter at a restaurant: when you (the customer) want food, you tell the waiter (the API) your order. The waiter then passes that order to the kitchen (the server), where the food (data) is prepared, and finally, the waiter brings your order back to you. The waiter doesn't cook the food itself but ensures that the right request is made and the correct response is given.&lt;/p&gt;

&lt;p&gt;Without APIs, your app wouldn't be able to interact with other systems to retrieve data, update information, or perform actions like logging in, making purchases, or getting location data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding APIs and JSON&lt;/strong&gt;&lt;br&gt;
An API allows one system to communicate with another, exchanging data in a format that both systems can understand. This is where JSON comes into play.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-life Example: Ordering Food Online&lt;/strong&gt;&lt;br&gt;
Imagine you want to order food from an online app like Uber Eats or DoorDash. Here’s what happens behind the scenes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; You open the app and enter your delivery details (name, address, food choices, etc.).&lt;/li&gt;
&lt;li&gt; The app sends your order to the restaurant’s system using an API, which is a communication method between different applications.&lt;/li&gt;
&lt;li&gt;The app sends this data in JSON format, like this:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flzqjx4a01pmm3gbf9l2m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flzqjx4a01pmm3gbf9l2m.png" alt="Image description" width="800" height="555"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The restaurant’s system processes your order and sends a confirmation back to the app in JSON format, like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpacsec3hv64lqqyjv0h7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpacsec3hv64lqqyjv0h7.png" alt="Image description" width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The app can then display the message, "Your order is confirmed!" in your interface.&lt;/p&gt;

&lt;p&gt;In this case, JSON is used to send and receive information between the client (the app) and the server (the restaurant system). This client-server communication is a key aspect of how modern web applications work, with the client (user interface) making requests to the server, which processes those requests and sends back the necessary data.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Moving on to Parsing JSON&lt;/strong&gt;
&lt;/h2&gt;
&lt;h2&gt;
  
  
  What is Parsing?
&lt;/h2&gt;

&lt;p&gt;Now that we understand how data is exchanged using JSON, let’s talk about parsing.&lt;/p&gt;

&lt;p&gt;Parsing is the process of converting a JSON string into a usable JavaScript object or another data structure. Since JSON is sent as a string, it needs to be converted back into an object to access and manipulate the data&lt;/p&gt;

&lt;p&gt;Imagine receiving JSON as a message or note—we need to decode it into something we can understand and use.&lt;/p&gt;
&lt;h2&gt;
  
  
  Example of Parsing:
&lt;/h2&gt;

&lt;p&gt;Let’s say we have a JSON string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; '{"name":"John", "age":30, "isStudent":false}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To use this data in JavaScript, we convert it into an object using JSON.parse():&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fezqqtggit56kq3jyrix8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fezqqtggit56kq3jyrix8.png" alt="Image description" width="800" height="624"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Stringifying JSON: Why and How?&lt;br&gt;
Just as we parse JSON to use it, sometimes we need to convert objects into JSON when we send them to a server. This process is called stringifying.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faijwcp142gha9in2d4xw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faijwcp142gha9in2d4xw.png" alt="Image description" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  This Was Not Always the Case: The Rise of XML
&lt;/h2&gt;

&lt;p&gt;While JSON is widely used today for data exchange, this wasn't always the case. In the earlier days of web development, XML (Extensible Markup Language) was the go-to format for exchanging data. So, what exactly is XML, and why was it replaced by JSON?&lt;/p&gt;

&lt;h2&gt;
  
  
  What is XML?
&lt;/h2&gt;

&lt;p&gt;XML is a markup language much like HTML, but its purpose is to store and transport data rather than display it on a webpage. It uses a system of tags to describe data in a hierarchical structure, which allows machines to understand and process it. Here's a simple example of how XML looks:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6etg8vapanvi3o4inrb3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6etg8vapanvi3o4inrb3.png" alt="Image description" width="800" height="557"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this XML structure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The  tag represents the overall data object.&lt;/li&gt;
&lt;li&gt;The , , , and  tags describe the data attributes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Was XML Replaced with JSON?
&lt;/h2&gt;

&lt;p&gt;While XML served its purpose well, it came with some disadvantages that made it less suitable for modern applications:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Complexity: XML can be verbose and harder to read. The extra opening and closing tags, such as , , add unnecessary overhead.&lt;/li&gt;
&lt;li&gt;Parsing: Parsing XML (interpreting the data so it can be used) is more complex and slower compared to JSON. The format requires additional tools and libraries to handle the parsing and manipulation of data.&lt;/li&gt;
&lt;li&gt;Data Size: XML’s verbosity means it tends to be larger than JSON, making it less efficient for transferring large amounts of data, especially over the internet.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How JSON Replaced XML
&lt;/h2&gt;

&lt;p&gt;JSON emerged as a simpler, more efficient alternative to XML for data exchange, especially in the world of web APIs. Here's why JSON quickly gained favor:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Lightweight: JSON is more compact and easier to read. There are no unnecessary tags, just simple key-value pairs.&lt;/li&gt;
&lt;li&gt;Faster Parsing: JSON is easier for machines to parse because it directly maps to native data structures like JavaScript objects (for example, key-value pairs). This results in faster processing compared to XML.&lt;/li&gt;
&lt;li&gt;Better for Web: JSON is more compatible with JavaScript, which is the primary language of the web. This makes it a natural fit for web development.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Summary:
&lt;/h2&gt;

&lt;p&gt;A Shift Towards Simplicity and Efficiency&lt;br&gt;
In modern web development, JSON has largely replaced XML because it is simpler, faster, and more efficient. JSON's easy-to-read structure and quick parsing have made it the preferred choice for exchanging data between servers and clients. XML, while still in use in some legacy systems, is increasingly being replaced by JSON in the world of APIs and data transmission.&lt;/p&gt;

&lt;p&gt;This shift has made data exchange much smoother and faster, benefiting the development of interactive web applications and APIs that we use today.&lt;/p&gt;

&lt;p&gt;Have you used JSON in your projects before? Share your experience with us in the comments, and let's discuss how it made your development process easier&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
