How to access weight of a paragraph in twig? I use paragraphs with my content type. I need to show weight (order) value of each paragraph in my twig template. I can change weight with select box when I edit the node, but I can't figure out how to get it in twig.

I thought it would be something like this:

function ws_preprocess_paragraph(&amp;$variables) 
{
    $par = $variables['paragraph'];
    $myweight = $par-&gt;weight;
}


Please help)
The weight of a paragraph is not stored in the paragraph itself, but in the host field.
So if you need to get the weight of a paragraph from within the paragraph (e.g. from  within hook_preprocess_paragraph()), you have to go upwards to the parent entity and find your the weight there:
function MYMODULE_preprocess_paragraph(&amp;$variables) {
  $paragraph = $variables['paragraph'];
  $parent = $paragraph-&gt;getParentEntity();
  // get all paragraph IDs sorted by weight
  $weights = array_map( function($a) {return $a['target_id'];}, $parent-&gt;get($paragraph-&gt;get('parent_field_name')-&gt;value)-&gt;getValue());
  // find the weight of my paragraph ID
  $weight = array_search($paragraph-&gt;id(), $weights);
  // ...do stuff with $weight... e.g. assign it to a Twig variable
  // $variables['weight'] = $weight;
}

Please note that the weight is easier to get if you use the paragraph host field template instead (see @4k4's comment below the original question):

Use {{ loop.index0 }} in a field template like
field--field-paragraph.html.twig